For anyone who finds this later, I figured out how to create a UUID using node (thanks to @sid for the excellent article here
-
Install the UUID package by going to Terminal and typing
npm install uuid
-
Create these three folders in the root (extensions/server_connect/modules):
-
Create a javascript module for the guid (I called mine guid_create.js) and add this code:
// JavaScript Document
const { v4: uuidv4 } = require('uuid');
exports.getValue = function (options, name) {
const id = uuidv4();
return id;
}
- Create the custom.json file with this code:
{
type: 'guid_create',
module : 'guid_create',
action : 'getValue',
groupTitle : 'My Modules',
groupIcon : 'fas fa-lg fa-project-diagram comp-images',
title : 'Create Guid',
icon : 'fas fa-lg fa-file-alt comp-images',
dataPickObject: true,
properties : [
{
group: 'Create GUID',
variables: [
{ name: 'name', optionName:'name', title:'Name', type:'text',required: true, defaultValue: ''},
{ name: 'output', optionName: 'output', title: 'Output', type: 'boolean', defaultValue: false }
]
}
]
}
Sid’s article above does a good job of explaining the parameters for the hjson file so I won’t repeat that here.
-
The new module should show up in server connect:
-
Add the module to your server connect API:
-
Use your new guid variable in your insert statement!: