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

Question

Question

Incrementing a Value in Workflow

asked on December 9

In self-hosted Workflow there is an option to enable a single instance mode for a workflow. This is really helpful for different situations, like when you need to auto increment a value from a database.

I have a situation in Forms where I have a lookup table that houses various number values. I need to look up the largest number and increment it by one. Then add the incremented value to the lookup table. I don't want the same number value in the table twice. The problem is that sometimes we have seen Workflow take a while to run on some instances and don't want the possibility for it to return, in different instances, the same incremented value because the value in the table wasn't updated yet. I'm looking for some solutions for this scenario.

1 0

Replies

replied on December 10

Workflow is not synchronous and with multiple servers in cloud , the order is not guaranteed either. Even in self-hosted, there could be multiple simultaneous forms attempting to start a workflow, only one will succeed if the workflow is in single-instance mode. And the asynchronous nature of Workflow potentially adds more latency.

The better solution is to call a SQL sequence to get the next value. SQL Server will handle concurrency.

For cloud, with direct database connections, you can call directly into SQL from the form without having to call a workflow. 

0 0
replied on December 10 Show version history

Thank you, Miruna. Unfortunately, a direct database connection is not a possibility for this Cloud system.

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

Sign in to reply to this post.