Flow Designer: flow running simultaneously, causing duplicate unique ID in custom record

Muhammad Salar
Giga Sage

Hi All,

I am using the Create Record action in Flow Designer to insert records into a table. To set a unique ID for each record, I call a Script Include. This Script Include queries the same table to find the last used unique ID, then generates a new unique ID by incrementing that value by one. However, when multiple flows run simultaneously, this approach results in duplicate unique IDs being created.

How to prevent it?

1 ACCEPTED SOLUTION

@Muhammad Salar 

you can't make flow run sequentially when multiple records are inserted.

the only way to achieve is make that field unique and use before insert business rule to set the value.

Don't set value via flow on that field.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Muhammad Salar
Giga Sage

@Ankur Bawiskar @Dr Atul G- LNG Can you look into this issue?

Bhuvan
Kilo Patron

@Muhammad Salar 

 

Why do you need to create Script Include to achieve this ? 

 

You can use auto-numbering records in a table,

 

https://www.servicenow.com/docs/bundle/yokohama-platform-administration/page/administer/field-admini...

 

Can you explain more if the requirement is different ?

 

Thanks,

Bhuvan

@Bhuvan  
Becasue i have different prefixes and different number sequences for different types.

 

@Muhammad Salar 

 

If you can share screenshot of your flow it would be easier to understand what you are trying to achieve.

 

There are multiple ways of addressing this record uniqueness check in the flow. You can lookup for a existing record and only if the condition evaluates to false, you can create new record. Check for coalesce field 'determines uniqueness' option if you have unique attribute as part of create/update record action.

 

Look for more details on the property, com.glide.hub.flow_engine.indirect_recursion_limit for Flow Designer system properties,

 

https://www.servicenow.com/docs/bundle/washingtondc-build-workflows/page/administer/flow-designer/re...

 

Thanks,

Bhuvan