Able to Get SYS ID Before Submit?

chaslage
Kilo Guru

I am currently working on User creation via Service Catalog, it's really just an RITM that submits to our AD group and another group.  

 

I need to submit them a GUID on the form and I figured the SYS ID would work perfectly for this...   However the field is a variable and it should populate on submission though since it's a catalog item there is no way to manipulate the UI Action to get that SYS ID.

 

Now it doesn't HAVE to be the SYS ID of the RITM being filled out, but it needs to be unique every time.   I figure a 16 or 32 character MD5 will do the trick but does ServiceNow hand those out on request?

 

At previous companies I have just used this script, which has worked well:

http://css-tricks.com/snippets/javascript/javascript-md5/

 

I would just create a Script Include for it and send the MD5 back to the Client Script onSubmit.   I should mention that it's not for a password, just a way for these records to come together later and recognize they are for the same person.

 

Should I go ahead with my method of generating an MD5 or bark up another tree?

 

Thanks!

1 ACCEPTED SOLUTION

Jace Benson
Mega Sage

You can access the sys_id it is going to use by looking at the element 'sysparm_item_guid'.



Client side, this will return the value with the prototype library that's available in SN.


$('sysparm_item_guid').getValue();



Well it's not the sys_id of the request but it's unique per page load.


View solution in original post

6 REPLIES 6

Jace Benson
Mega Sage

You can access the sys_id it is going to use by looking at the element 'sysparm_item_guid'.



Client side, this will return the value with the prototype library that's available in SN.


$('sysparm_item_guid').getValue();



Well it's not the sys_id of the request but it's unique per page load.


Thank you a thousand times, that's silly that I don't know that.


After further looking into it.   This is the cart sys_id.


That's fine, as long as it is random every time it works for me.   If you could get the RITM SYS ID then that'd be bonus, but this GUID is fine with me.