Get sys_id before insert (Catalog Item in Cart)

kevinme
Mega Contributor

Hello everyone

Is it possible to get the sys_id of a record before inserting it? I would like to get the sys_id of the record, which is created when a catalog item is added to the cart (sc_cart_item). I know, that this sys_id is on the form in a hidden field with the id "sysparm_item_guid". Since I'm not using the out-of-the-box form I cant access this field.

Any help is appreciated

Kevin

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

What exactly are you trying to do? Could you post the code for your custom page?


Hi Brad



I use a processor to get catalog items (and variables) from ServiceNow. The catalog item   (including the form for the variables) is rendered in an AngularJS Application. To add Attachments to the request before adding the catalog item to the cart I need the sys_id of the record (similar to here: Adding attachment button to service catalog request )



Somehow ServiceNow seems to "know" which sys_id the record in the sc_cart_item table will get, even though the documentation states, that the sys_id is created when gr.insert() is called.



Thank you!