tags:

views:

43

answers:

1

In infopath script (J), how do I generate a GUID?

This is my current and comletely hacked (and horrid) method.

var getGuid = new ActiveXObject("ADODB.Recordset");
getGuid.Open("SELECT NewId()", mySqlConn);
var guid = getGuid.Fields(0).Value;

There has to be a better way...

A: 

Try this

function getGUID()
{
    return new ActiveXObject("Scriptlet.TypeLib").GUID;
}

Your form will need to be Full Trust otherwise you will get a script error.

Nathan Fisher

related questions