f.falomir@ube.es

"Fake" Unique Value to identify a list element before it is created

Blog Post created by f.falomir@ube.es on Nov 13, 2017

Dear all:

It's a simple workaround to assign a temporary "unique" value to an element before create it in the list.

 

When you are creating an new element using Nintex Forms, you don't have the "ID" value until you "save" the element the first time.

 

Imagine you want to link some child list elements before save the parent element the first time. You need the parent element "primary key" to link with the child, commonly the "ID"

(Check Forms: Parent / Child structure using List view Control to know how to link a parent element with a child elements in a separate list)

 

I don't know how to generate a "unique value" into Nintex Forms in a easy way , so the workaround could be to generate a temporary "ID" as a "fake unique value"   to assign to the new child items.

 

Then, when you save the parent element and run the workflow, it could re-assign the "ID" just created to the child elements,  getting the child list items in a collection variable, looking for the elements with the "fake unique value", and changing the linking field to the correct "ID"

 

Here is the conceptual workflow:

 

Now, here is the approach to generate a "fake unique value" into the nintex forms. It's a fake, but it works!

 

Th idea is to use the current date / time and the current user  into a disconnected calculated field. As for sure you are "unique" in the active directory, and you can't be in two places at the same time (if you are a God, it could be), the value is "unique"!! 

 

 

Here is the formula (sorry, in Spanish):

 

  • Fecha Actual: Current date
  • Hora Actual: Current time
  • Usuario actual: Current user

 

Now, you must send this "fake unique value" to the child element adding the value at the end of the URL string. In the new child element form, you can get this value, as shown in Forms: Parent / Child structure using List view Control 

 

Then, when you finally save the parent element, and the workflow begins to run, you can change this fake value by the appropriate "ID". In my case, I'm using not the ID but a sequential fiscal year / number generated by the workflow, but the approach is the same (because I can't generate this number in the Forms).

 

That's all. 

Have a nice day!!

 

Outcomes