Generating a random UUID in a service action

I would like to generate a UUID in a service action. In a regular action client side I can use crypto.getRandomvalues, however this does not work in a service action. Is there a simple way of accomplishing this? (using Math.js is not recommended due to lack of randomness). I am aware of “Random identifier” but that value can never be changed, and I need to change this.

Hi @Johan18

You could consider implementing a solution where you maintain a separate data source specifically for generating random identifiers. This approach would involve creating a random identifier, retrieving the random value as needed, and then promptly removing it from the data source.

Additionally, it’s worth exploring the availability of APIs designed for generating UUIDs. Although we don’t have direct experience with such APIs, they could offer a more streamlined and robust solution to your UUID generation needs.

1 Like