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

Discussion

Discussion

Forms - ID number

posted on May 19, 2020

Greets!

I have a need in a form to generate a sequential number and put that number into a Variable (like A0000001, A000002, etc.) .  Once a number is issued, need to +1 for the next form.

I have a few thoughts, but I'm much more comfortable figuring this out in Workflow.

 

Thoughts?  Brainstorms?

 

0 0
replied on June 9, 2020

So, I came up with my own solution.  I'm sure it is not a novel solution for this sort of thing, but it is similar to a strategy I've used before.

You see, I like to stay within the LF toolbox whenever possible.  Integration with SQL is great, but also involves a DBA and adding to a DB.  Down the road when you make changes to the environment it is something you will need to remember and check the documentation for.

So, if it isn't too hard and functions, I do it within LF.

Solution:

  1. Initial form filled out in Forms. 
  2. Use a workflow service task to call the workflow
  3. Worfklow reads the current count from a field in a specific document protected from access by all other accounts.
  4. Increment the number, format the token as needed, set the BP variable to pass back to Forms.
  5. Write the incremented value back to the field value.
  6. Workflow ends
  7. Forms continues with new value.

 

This way, no DB or stored procedures.

This technique has many uses - creating variables, templates of documents, address lists, etc. - in the repository to be used by WF as needed.  Users can be given access to these as needed and can keep you from having to edit hard-coded workflows.

Another solution for the future admins out there.  May it help someone out someday.

0 0
replied on June 9, 2020

Sort of using LF metadata as your own mini database, nice. 

0 0
replied on June 10, 2020

This has the same problem as some of the other solutions discussed before: it can produce duplicate numbers. Workflow is multi-threaded so, depending on your load on Forms, you may have multiple instances reading the value at the same time.

0 0
replied on June 10, 2020

AH.  Hmmm.   no way around that?

0 0
replied on May 19, 2020

Does the number need to show up on the initial form? Or can it be added to the form instance after the initial submission? If it needs to show on the initial form, if say form A000007 was loaded onto the form but never submitted, should a different form get that ID number? Or can A000007 be omitted?

I think the easiest way to do this would be to not show this ID number on the initial form. After the user submits the form, run a WF to check a database for the next available number. Format it A0000xx and send it back to Forms, then increment the number in the database. This would ensure that only submitted forms instances get an ID number, but wouldn't show that ID number on the message start event form. 

1 0
replied on May 19, 2020

Getting the ID number after the initial submit is acceptable. Actually, either way would work - it should be fine if there are missing numbers in the sequence as long as the numbers are unique.  Preference would be to not have missing numbers, but if it's a lot simpler to not care about missing numbers, that's fine.

So... is there a demo somewhere of calling the wf and handing it back to a forms process like this?

0 0
replied on May 19, 2020

I don't have a demo, but someone in the LF community might. 

0 0
replied on May 19, 2020

This topic has been discussed quite a bit in Answers. See  here, here, here and here.

1 0
replied on May 20, 2020

So sorry - I should have searched yesterday.  Thanks for the leads, Miruna.  :)

 

0 0
replied on May 20, 2020

No worries.

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

Sign in to reply to this post.