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

Question

Question

how can I generate an incremented Id number with workflow ?

asked on July 9, 2014

I save mails in Laserfiche. How can I an incremented Id Number on each one ? For example if the first saved mail have 1 as Id number, the second mail should have 2...

 

0 0

Replies

replied on July 10, 2014

Hi Moana, 

 

If you would like a counter that goes up by one for a specific type of document, Workflow can easily handle this! I often accomplish this by storing my counter value in a field applied to one of the root folders of the repository. This field can be hidden from most users' view, and need only be accessible by Workflow. Then I build a workflow that looks something like this, that runs every time a new document of the desired type is created in the repository:

Similarly, this value could be stored in a table, in which case you would retrieve the value with a Query Data activity and put the incremented value back into the table with an Update Data activity. 

3 0
replied on May 1, 2015

Aha!

 

This looks like what I need.  Somehow I didn't find it while searching, though.

Kelsey - When we were discussing this here: https://answers.laserfiche.com/questions/76299/Which-way-to-have-a-global-counter  it sounds like there could be problems with the lack of locking, where two workflows running at the exact same time could get the same ID number.

 

Have you ever seen this?  I'm thinking that while this is possible, it would probably never happen in how this WF will be used.

0 0
replied on May 1, 2015

Hi Michael,

Miruna is correct that Workflow, while a simple solution, could cause some problems. It comes down to how often your process is running.

If it's a process primarily started by one person or isn't used by very many people at the same time you should be fine with a simple workflow.

If the process has a significant probability of multiple simultaneous instances then one of the other proposed solutions would be a better fit.

1 0
replied on June 23, 2015

Thank you Kelsey.  I am numbering documents dumped into a folder by Import Agent.  I had no success with an SQL Query due to double ups on the number (I did not go as far as adding script to SQL).

I added your workflow routine into a Simple Synchronization Sequence and it works fine.

I can dump 50 documents into one folder and they are all numbered sequentially.

0 0
replied on July 9, 2014

If you want them to be incremental and have no gaps, then you can use the EntryID, which is going to be unique for each entry in the repository. 

 

If you want something incremented without gaps, you might need to use a SQL table and a stored procedure to stored in the entryID of the email message and return you the next number in the sequence for your usage. 

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

Sign in to reply to this post.