I checked, and just converted my passed sys_id's to string and it worked.
But, because of this sn_sc.CartJS method, my case creation is all hampered.
I am using a record producer to create case, and a BR is running on case creation inside which I have called a script include with final code as below.
It is causing creation of 70-100 ce and RITMs.
Please assist.




 

createRitmFromCase: function(caseGr) {

        var catItem;

        var catSrch = new GlideRecord("sn_customerservice_case_itsm_decision");
        catSrch.addQuery("u_category", caseGr.category);
        catSrch.query();
        if (catSrch.next()) {
            catItem = catSrch.u_catalog_item.toString();
        }
        var cart = new sn_sc.CartJS();
        var item = {
            'sysparm_id': catItem,
            'sysparm_quantity': '1',
            'variables': {
                'customer_name': caseGr.contact.toString(),
                'approving_data_steward': caseGr.u_approving_data_steward.toString(),
                'organization': caseGr.account.toString(),
                'u_organization_erp': caseGr.u_organization_erp.toString(),
                'category': caseGr.category.getValue(),
                'subcategory': caseGr.subcategory.getValue(),
                'u_priority': caseGr.u_priority.getValue(),
                'u_line_items_included': caseGr.u_line_items_included.getValue(),
                'u_impacted_organization_s': caseGr.u_impacted_organization_s.toString(),
                'notes': caseGr.short_description.getValue(),
                'u_department': caseGr.u_department.getValue()
            }
        };

        var cartVals = cart.addToCart(item);
        var checkoutVals = cart.checkoutCart();