How to generate the UUIDv4 value?

I need to insert a new record into the database table.
I need to specify the ID field value (UUIDv4).

Is there an existing function?
Or do I need to implement some manual UUID generation?
Like in example

@ivp Here’s an example app that shows how to generate UUID using Math.random but as mentioned in the link you shared this is not advisable. What database are you using?

What database are you using?


Check out this post - postgresql - Generating a UUID in Postgres for Insert statement? - Stack Overflow

Yes, I understand that UUID can be generated on the DB-level too.
But, thanks for the exact link!

1 Like

If appsmith would support the new browser built-in crypto functions, we could do it easilly:

let myUUID = crypto.randomUUID();

But I see it’s not recognized in a js object function. Maybe a good improvement?