Script to Generate a UUID

Comments

8 comments

  • Youssef Zouhairi Solutions Consultant
    Engaged
    Celigo University Level 4: Legendary

    Hi Dave, 
    I believe, you just need to use the handlebar "random" : https://docs.celigo.com/hc/en-us/articles/360039326071-Handlebars-helper-reference#random


    0
  • Youssef Zouhairi Solutions Consultant
    Engaged
    Celigo University Level 4: Legendary

    0
  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    You would need something like this. Since it's v4, 4 needs to be hardcoded in the 3rd section.

    {{random "uuid" "8"}}-{{random "uuid" "4"}}-4{{random "uuid" "3"}}-{{random "uuid" "4"}}-{{random "uuid" "12"}}

    0
  • Dave Guderian
    Engaged
    Celigo University Level 4: Legendary
    Awesome Follow-up

    You guys are the best! Thanks so much Youssef and Tyler!

    0
  • Mike Gonzalez

    I'm not sure why, but Tyler's handlebar formula did not work for me.  Even hardcoding the 4 into the 3rd segment, it was still getting rejected.  After playing around for a while, I finally came up with this.  Basically the same concept, except it takes a valid string from each segment of several full UUIDs instead of explicitly specifying the segment length in the Random function.

     

    {{substring (random "uuid") 0 8}}-{{substring (random "uuid") 8 12}}-{{substring (random "uuid") 12 16}}-{{substring (random "uuid") 16 20}}-{{substring (random "uuid") 20 32}}
    0
  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    Mike Gonzalez good catch! When I put your output into a UUID validator, it comes out good whereas mine comes out not good.

    0
  • Mike Gonzalez

    Thanks Tyler!  I'm just glad the solution did not require a script as I have to send a unique UUID in the request header of all calls including the refresh token request.

    Does Celigo Community have an idea portal?  I'd like to suggest that they develop a similar Random function to return back a fully formatted UUID with separators as that appears to be a fairly common requirement.

    0
  • Kathyana Queeman Community moderator Technical Writer
    Engaged
    Celigo University Level 2: Seasoned

    Hi Mike Gonzalez

    The most efficient and easiest way would be to submit your idea through our Product Portal. You can also see what's coming in the future and provide input on existing ideas. 

    Thanks! 

     

    0

Please sign in to leave a comment.