Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to pass variables in service catalog item to sn_sc.CartJS() in Scripted REST API?

Phalguna
Mega Contributor

Hi,

How to pass the variables of service catalog item to sn_sc.CartJS() .actually I am trying to call the sn_sc.CartJS() API in Scripted REST API.

I have to pass the four variables namely user,location,created by, action type, 

Regards,
Phalguna

 

10 REPLIES 10

@Phalguna 

the above would help you placing the order and it would create REQUEST and RITM as well.

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Need your help.I'm having issue with one catalog item and it giving null pointer exception.

I see the null pointer error in log but how do I identify what is causing this and where to find the code for 

sn_sc.CartJS();

I created new thread. Can you please provide some input?

https://community.servicenow.com/community?id=community_question&sys_id=36639096dbc6589011762183ca96...

 

Thanks,

Ashraf

Also, to get the REQ and RITM number from the submitted catalog item, you can use the below code to fetch both values

gs.print("REQ number is " + checkoutInfo.request_id); // This is REQ number
	var gr = new GlideRecord('sc_req_item');
    gr.addEncodedQuery('request.sys_idSTARTSWITH'+checkoutInfo.request_id);
    gr.query();
    if(gr.next()) {
        gs.print("RITM number is " + gr.number);  // RITM number
    }

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Phalguna 

Hope you are doing good.

Let me know if that answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@Phalguna 

Hope you are doing good.

Let me know if that answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader