How to Create a Unique Order ID in Power Automate from SharePoint Changes
Question details
The user needs to set up a Power Automate flow that generates a unique order number in a new SharePoint list when an existing item is modified, while avoiding duplicate entries upon repeated edits.

- Product
- Power Automate and SharePoint
- Device & OS
- not provided
- Scenario
- Automating order creation across SharePoint lists based on item modifications without triggering infinite loops.
- Observed behavior
- The goal is to automatically generate a formatted, unique order ID (e.g., using an 'ORD-' prefix) and update the original list to mark the item as processed, successfully preventing duplicate triggers.
Ensure you have Edit permissions on both the source and destination SharePoint lists, and an active Power Automate license to create and manage automated cloud flows.
Build the Power Automate Flow to Generate a Unique Order ID
Use trigger conditions and SharePoint list item IDs to reliably generate sequential, unique order numbers while preventing loop triggers.
To prevent duplicate orders when the trigger item is edited repeatedly, you must use a trigger condition combined with a write-back update to the original SharePoint list.
In Power Automate, click 'Create' and select 'Automated cloud flow'. Choose the SharePoint trigger 'When an item is created or modified' and link it to your source list (List A).
Click the three dots (...) on the trigger action, select 'Settings', and scroll to 'Trigger Conditions'. Add an expression such as @equals(triggerOutputs()?['body/CreateOrder'], true) so the flow only runs when specific criteria are met.
Add a new step and select the SharePoint 'Create item' action for your destination list (List B). Map the relevant customer information fields dynamically from the trigger outputs.
Use the automatically generated ID from the 'Create item' action (List B) to form your unique order number. You can format it by adding a prefix using a Compose action with an expression like concat('ORD-', outputs('Create_item')?['body/ID']).
Add an 'Update item' action pointing back to List A. Update a status column (e.g., set 'Order Processed' to 'Yes' and 'CreateOrder' to 'No'). This ensures the trigger condition in step 2 will fail on future modifications, preventing duplicate orders.

Consult the Microsoft Power Automate Community for Complex Numbering
For highly complex numbering mechanisms or specific edge cases outside standard SharePoint triggers, consult the official community.
Boost Your Office Productivity with WPS Office
While Power Automate and SharePoint handle your cloud workflows, WPS Office is the perfect lightweight, free alternative for handling your generated Excel reports, Word documents, and PDF invoices.
- 1. Download WPS Office: Visit the official WPS website and click 'Download' to get the free office suite installer.
- 2. Install the Software: Run the downloaded installer and follow the quick setup wizard to install the software on your computer.
- 3. Manage SharePoint Exports: Open any downloaded SharePoint list data exports (.xlsx) directly in WPS Spreadsheet with perfect formatting retention.

Frequently Asked Questions
Why is my Power Automate flow creating duplicate orders?
Duplicates usually occur if the flow triggers multiple times upon consecutive item modifications. You must use trigger conditions in your flow settings to ensure it only runs once per approved item, and update the source item's status at the end of the flow.
Can I reset the auto-incrementing SharePoint ID for my order numbers?
The default SharePoint list ID column cannot be reset or modified. If you need a resettable sequence (like restarting at 1 every year), you must maintain a separate configuration list that stores the current highest number.
How do I add leading zeros to my SharePoint order ID in Power Automate?
You can pad the ID with leading zeros using a Power Automate expression. For example, using the expression formatNumber(triggerOutputs()?['body/ID'], '0000') will format an ID of 5 as '0005'.
Why does updating List A cause an infinite loop in my flow?
Updating List A counts as a modification, which is the exact event triggering your flow. Adding a trigger condition that stops the flow if the item is already marked as 'processed' effectively breaks this loop.




