cancel
Showing results for 
Search instead for 
Did you mean: 
cdesai
Nintex Newbie

2 workflow instance executes at same time

Jump to solution

I am working in Nintex 2013 (and Sharepoint 2013).

Requirement: When employee joined the company, employee details are entered in SharePoint list Employee and after save Unique ID is generated. This ID is fetched from GenerateID list which has 1 row 1 column. 

During save of list item, Nintex workflow fetch latest ID from GenerateID list and Increment it with 1 and assigned it to column Employee ID (Latest ID + 1) in Employee list and override this latest ID in GenerateID and for another new Employee it will do the same activity and so on. In short, every Emp should have unique ID.

Issue

this application is used across location which result in duplicate ID - may be multiple Admin. clicks on SAVE button at same time. This rarely happens, but what could be fix for this. How to restrict workflow instance to stop till earlier workflow instance finish its activity. 

- Chintan

0 Kudos
Reply
16 Replies
Automation Master
Automation Master

Re: 2 workflow instance executes at same time

Jump to solution

sharepoint doesn't provide OOTB any (reliable) unique ID/sequencer generator (apart from item ID). so you can avoid situations like you described.

either you will rely on item ID or you have to use some external source.

see as well following links

how to query for site content type  

 

0 Kudos
Reply
cdesai
Nintex Newbie

Re: 2 workflow instance executes at same time

Jump to solution

Hi Marian, your link shows how to generate ID, that i already achieved it. My concern is during generating ID, 2 users clicks the save button at precisely the same time/second which in turn make workflows instances execute the same item which result in 1 workflow wins and other goes to failure. 

0 Kudos
Reply
Automation Master
Automation Master

Re: 2 workflow instance executes at same time

Jump to solution

you haven't mention anything about workflow failure in your post...

I understood it you want to resolve duplicated IDs.

there is no way how you could serialize updates to single item.

what you could do in case of error is that you try to repeat the operation. but that would resolve just update operation on GenerateID list itself.

but that will still not resolve problem of getting the same ID for two or more employees!

furthermore, depends on what exactly you do between reading and updating of GenerateID list, it may happen that longer running workflow sets back current ID  by several values.

0 Kudos
Reply
Highlighted
janvonreith
Nintex Newbie

Re: 2 workflow instance executes at same time

Jump to solution

Isn't it an option for you to create a Unique ID with the help of current time stamp or something like this?

0 Kudos
Reply
Automation Master
Automation Master

Re: 2 workflow instance executes at same time

Jump to solution

discrete interpretation of time in digital world IS NOT unique.

and in sharepoint, with (mostly) minutes-level precision or even (rarely) seconds-level precision, definitely not.

0 Kudos
Reply
janvonreith
Nintex Newbie

Re: 2 workflow instance executes at same time

Jump to solution

Ok if you only use the stamp you're right, but if the seconds are included I think it's very unlikely that there'll be duplicates.

What do you think about a combination of the List ID and the Element ID? ;-)

0 Kudos
Reply
Automation Master
Automation Master

Re: 2 workflow instance executes at same time

Jump to solution

‌ this is the perfect scenario for you to blog about that awesome ID fetcher thing you did...

Reply
Automation Master
Automation Master

Re: 2 workflow instance executes at same time

Jump to solution

I think it's very unlikely that there'll be duplicates

Murphy's laws say, if anything can happen it will definitely happen and will happen when you expect it the least and when it can cause the most problems

if you want to ensure uniqueness, you have to use reliable source that in no circumstances returns a duplicate value.

What do you think about a combination of the List ID and the Element ID

nice combination , was that the question?

but seriously, I'm not sure what you exactly mean with 'list ID'. is it  list's GUID? or item's ID within the list? or anything else?

and I'm totally not sure how should I understand 'Element ID'.

can you provide some example/further explanation?

Reply
Automation Master
Automation Master

Re: 2 workflow instance executes at same time

Jump to solution

I'm eager to read about it ...

Reply