0

var cart = new sn_sc.CartJS();
//cart.setRequestedFor('a8f98bb0eb32010045e1a5115206fe3a');
var item = {
    'sysparm_id': '240e333a1bc456902b1811f72a4bcb4a',
    'sysparm_quantity': '1',
    'variables': {
        "short_description": " Sales Escalation"
    }
};
var cartDetails = cart.orderNow(item);
var getNum = JSON.stringify(cartDetails);
var getNum1 = JSON.parse(getNum);
  gs.info("email.body.support_group=" + getNum1.number);
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request.number", getNum1.number);
gr.query();
if (gr.next()) {
    gr.short_description = email.from + " Sales Escalation";
    gr.description = email.body_text;
 if(email.body.support_group=="Retails Support")
    gr.assignment_group = "f6cc6838d7b122004f1e82285e610317"; // billing support
 if(email.body.support_group=="Payment Support")
    gr.assignment_group = "f6cc6838d7b122004f1e82285e610317"; // billing support
 if(email.body.support_group=="Restaurant Support")
    gr.assignment_group = "f6cc6838d7b122004f1e82285e610317"; // billing support
    gr.update();
 gs.eventQueue('simple.matrix.escalation',gr,email.to,gs.getUserName());
}

CartJS API to create Service Catalog ServiceNow
Working Code Edited question August 20, 2024