Adding a unique "Batch ID" to a UD table

Hi there,

I have a UD table I am filling with data from a few tables and I am trying to figure out how to set some kind of transaction or batch ID to one of the Key fields. I am currently using BpmFunc.Now().ToString() in one of the fields but sometimes the group of records doesn’t all fill the table at the exact same second.

Example:

I have 3 Order lines that were transferred to to my UD table in the same transaction, The time stamp is 1 second off on the last line. Is there a way to set a similar value for each transaction that isn’t based on time so that all three of these rows would have the same Unique ID?

Line 1 - 8/1/2022 2:09:55pm
Line 2 - 8/1/2022 2:09:55pm
Line 3 - 8/1/2022 2:09:56pm

Thank you very much!
Korrie

Can you store the first timestamp in a variable and use that in each record you are writing?

1 Like

Just use Guid.NewGuid().ToString()

2 Likes

Hi Taylor - I haven’t tried that, only because I’m not quite sure how to do that, lol.

Hi Jose, thanks for the reply! I tried that, but it gives me a unique ID for each row.

Just do var gui = Guid.NewGuid().ToString() then assign gui to the field.s…

1 Like

The guid is the best way to do this, and like Jose said above, assign it to a variable and use that variable as the field value in your customization.

Are you doing this in a C# widget or a form customization or are you doing this in a BO widget?