PublicDocuments icon indicating copy to clipboard operation
PublicDocuments copied to clipboard

"GUID" as pre-defined transform data [feature]

Open ghost opened this issue 4 years ago • 1 comments

I was surprised to find that there's no option to insert GUIDs as data for Smart Object values. It looks like there's a couple of ways to manually craft a token string or scriptify it. Just seems like something that'd be there out-the-gate.

ghost avatar Feb 17 '21 22:02 ghost

Also be nice to have.

@ghost could use a custom value transformer:

var ValueTransformer = function() {

    this.displayName = "UUID Value";
    this.shortDescription = "Random UUID Value Generator"
    this.transform = function(inputValue, jsonValue, arrayIndex, parameters, info) {
        return uuidv4();
    };

    function uuidv4() {
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
            var r = Math.random() * 16 | 0,
                v = c == 'x' ? r : (r & 0x3 | 0x8);
            return v.toString(16);
        });
    }
}

markst avatar Aug 27 '21 05:08 markst