Random number or ID field

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Random number or ID field

Eusebio
Hi all,

I need to assign each form submission with a unique ID. Users will then use this ID in another system and we can track it through a full lifecycle.

Our submissions process is one button called 'Send' which does, 'Save, then email, then review'

I tried using 'random()' in the calculated field for the ID but that causes the form to give a browser warning on 'Send' which is 'You have unsaved data, Leave or Stay'. This is too confusing for the users and during our tests people clicked Stay and then the review doesn't load.

Ideally I would use the form ID which is also used as the barcode. We do pull this ID into the Subject though and the ID is not created until 'Save' I believe so how could we go around doing this?

Any other suggestions would be welcome however the ID seems the most obvious way to avoid a collision.

Thanks,

Eusebio
Reply | Threaded
Open this post in threaded view
|

Re: Random number or ID field

bruno.buzzi
Hi,

You can call a JavaScript function or create XPath function for this:

For XPath we put the field read only.
Read-Only:
true()

Inital Value:
concat(string(year-from-dateTime(current-dateTime())),'-Process-D2-', string((current-dateTime() - xs:dateTime("2013-01-01T00:00:00-00:00")) div xs:dayTimeDuration('PT0.001S')))

The disadvantage of this is the large number that creates.

May be using a Java Script to generate a UUID is a better idea.

regards,
bruno
Reply | Threaded
Open this post in threaded view
|

Re: Random number or ID field

Eusebio
Hi,

That did the trick, I amended the function a little bit so it's just a number outputted that sorted it. Makes sense now that it should be read-only and initial rather than calculated.

Thanks,

Eusebio