Generating Unique Transaction ID/Reference Number

Hi, for a transactional process that I am using I need to be able to create a robust and incrementing transaction ID. By robust I mean that it needs to continue increasing across different instances of the robot. I have thought about possibly saving the current number that it is on in a text file each time the workflow ends and reading that in and assigning it to the variable that continues increasing at the beginning of a new session, but maybe there is a better way? I also considered making a unique hash out of the current datetime or something but I’d like to avoid any overlapping IDs if possible.


Hi there @tjsauter,
You could utilise a GUID, for example:

While each generated GUID is not guaranteed to be unique, the total number of unique keys (2^128 or 3.4×10^38) is so large that the probability of the same number being generated twice is very small. For example, consider the observable universe, which contains about 5×10^22 stars; every star could then have 6.8×10^15 universally unique GUIDs.

From Wikipedia
(Stolen from :slight_smile:


That’s a fantastic answer and I absolutely wish that I could use it in this case, will certainly keep it in mind in the future, but unfortunately I need numbers only (6 digits to play with) and it needs to be predictably incrementing so I can isolate failures by session and we can identify what was done per user.

Thanks though! :grinning:

My apologies for reviving an ancient topic, but I’m currently facing the same problem. Wondering if anyone has any slick solutions :slight_smile:

Right now I’m storing the ID’s in an Excel and incrementing and writing back to it, but I was wondering if there’s a safer / better way.

1 Like