How do I get the sys_id of sc_cart_item before item is added to user's cart?

bjonesy
Tera Contributor

I want to validate that a user has attached a quote (e.g. uploaded .docx) to a catalog item before they submit the item to their cart.  To do this I want to check the sys_attachment table for any attachments.  When a user uploads the attachment, but before they add the item to their cart, SNow puts a record in sys_attachment with:

Table name = sc_cart_item

Table sys ID = <GUID of sc_cart_item instance>

The issue is SNow has not committed the sc_cart_item to the table until the user adds it to their cart so I can't get the sys_id of the sc_cart_item to check the sys_attachment table.  But obviously the session has the GUID since it inserted the GUID to the sys_attachment table.  Anyone know how to get a reference to the sc_cart_item GUID before the user submits the item to their cart?

Thanks in advance.

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

Try g_form.getParameter("sysparm_item_guid") in client script


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

5 REPLIES 5

Yep, we ran into this too.  

Here is the workaround we came up with:

https://community.servicenow.com/community?id=community_question&sys_id=46318be5db98dbc01dcaf3231f9619bf