We have a several customers that would like Forms to assign an unique sequential id. It would be great if we could simply use the Instance ID for this. However, since the instance id is sequential across Business Processes, we can't use it for any customer that has more than one forms process. Instead, we have to create a Workflow to assign a number. It would be much easier to use the instance id.
Discussion
Discussion
Feature Request - Forms Instance per Business Process
Does the ID you are looking for need to be shown to the person filling out the initial form, or can it be added afterwards?
It needs to be automatically filled in at the time of the initial form submission. Do you have an interesting idea that doesn't involve Workflow?
Preferably the person filling out the form but if you have an idea for the first task, that might work in some cases.
It would still include Workflow, but hear me out. First, create a database table with a single column as an int type. You can put any number you want as the value for the first record.
Then in your Forms process, after the initial form is submitted your first step would kick off a Laserfiche Workflow. This workflow would first do a query to find the max value for the SQL table column I mentioned earlier and return its value. It would then add 1 to that value, insert that value back into the database table, and then using the new features in Workflow 10, write it back to a field in the submitted form.
It would then be displayed to the person that receives the first user task.
You could have it displayed to the person filling out the form as well by creating a SQL view that brings back the MAX value and displays it back into the initial form, but depending on how many are being submitted at the same time, that same number may be assigned out more than once.
You could have a different table for each form that needs the number or add a second column with the value of form and in your queries from Workflow make sure it has a where clause of where form = '(value)'.
Hi Blake,
Thanks for the suggestion. We do something very similar for another customer which works fine. But if the form instance id was assigned per form, then the whole thing is solved and there is less work for all of us. Of course, you might need to add a little javascript to format the instance ID and put it into a field to fit the customers needs but that doesn't take much. With a form specific instance ID, there is no need for additional configuration or need to be concerned if multiple users are submitting forms at the same time.
Thanks for your input!
Jen
Blake, I don't recommend that approach. If two forms are submitted at the same time, two instances of the workflow would initiate simultaneously, and they would both get the same integer value from the table, resulting in duplicates.
We use sequence objects in SQL to generate unique sequential numbers. I think they're only available in SQL 2012 and later, though. If you're on a prior version, you can also use OUTPUT.
Thanks for the suggestion, Ege! Of course, I still think it'd be easier if the instance id were assigned by Form Process but this is a good workaround.
Sign in to reply to this post.
- Posted April 11, 2016
- Updated April 15, 2016
- 269 views