โ10-04-2024 08:32 AM
is there a way to create a random number?
I have a very rare use case that will require me to append something to an end of a number to make it unique.
rather than creating a variable and looping through it adding 1 (eating up tasks)
was wondering if there was some trick to just add a random number to my field to ensure its unique in this one off scenarios
Solved! Go to Solution.
โ10-04-2024 09:15 AM
It's kinda silly, but "rand" isn't supported as a formula method. It works in a Ruby action though.
Make a Ruby action, add an output field called "random_number", and use this as the code:
{random_number: rand(100)}
This will generate a random number between 0 and 99. You can update "100" to increase the range. If you want the range to start at 10000 for example, just add 10000 to the result.
โ10-04-2024 09:15 AM
It's kinda silly, but "rand" isn't supported as a formula method. It works in a Ruby action though.
Make a Ruby action, add an output field called "random_number", and use this as the code:
{random_number: rand(100)}
This will generate a random number between 0 and 99. You can update "100" to increase the range. If you want the range to start at 10000 for example, just add 10000 to the result.
โ10-04-2024 10:30 AM - edited โ10-04-2024 10:31 AM
thanks... was hoping a formula so I wouldn't have to use a task but if this is the only way.