You are viewing limited content. For full access, please sign in.

Question

Question

Generate Sequential Numbers in Workflow

asked on December 21, 2018

Hey everyone,

I'm hoping someone here might have done this before, or something similar. We have a process whereby local businesses can renew or apply for a new business license. Each license has a unique number assigned to it (10 characters total, with leading zeroes, i.e., 0000001234). 

What we'd like to do is have workflow automatically generate and return the next number in the sequence. Right now, we're at 0000003451. So the next time someone submits a license, we'd like for it to return a value of 0000003452, then both set that number on a Forms business process variable as well as use it for a simple field merge in Word.

The latter two steps I can accomplish on my own, but is workflow capable of identifying the next number in a sequence, and if so, how would I go about accomplishing this? Bear in mind this wouldn't be a batch - owners would be submitting their license applications or renewals individually, so workflow would have to be smart enough on each instance to know that the previous numbers have been assigned and it needs the next one in the sequence.

0 0

Answer

APPROVED ANSWER
replied on December 21, 2018

Workflow doesn't have any tools like that, but if you are running SQL Server 2012 or newer, you can make use of a sequence. You could create a sequence somewhere, and then call the sequence in a custom query activity.

1 0

Replies

replied on December 21, 2018

If I were doing it, I would create a “blank” document somewhere in the repository and have 1 metadata field on it for the last number used.

Then in the workflow you could have it find that document, retrieve the field value, use the token calculator to add 1 to it.  The you will have the new number and you can put in an activity that updates the “blank” document metadata.  And you can use the new number throughout the workflow.

The field would have to be a number field and not have the leading zeros.  But you can put the leading zeros on by formatting it in the workflow as D10.

0 0
replied on December 21, 2018

It depends on the volume of applications. You could very well end up with concurrency issues if you had more than one request come in at a time.

1 0
replied on December 21, 2018

Good point.  I have never used the Simple Synchronization Sequence before.  I don't know if it works between different instances of the workflow if this would help that issue or not.

sync.png
sync.png (11.88 KB)
1 0
replied on December 24, 2018

Using a blank document with a next number field and controlling access to it via a synchronization sequence worked well for me.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.