How we can create record producer using card api?

katiyar_arpit
Tera Contributor

 I want to create record producer using Card API. but it is creating RITM request instead of record product. 
could you please tell me how i can create the record producer using card Api don't want to use glide record. Below is the script i am using to create the record producer.

var cart = new Cart();

 

       var catItemGR = new GlideRecord("sc_cat_item");

       catItemGR.addQuery("name", "Contractor Update");

       catItemGR.query();

 

       if (catItemGR.next()) {

               var item = cart.addItem(catItemGR.sys_id);

               cart.setVariable(item, 'opened_by', lv_user_obj.sys_id);

               cart.setVariable(item, 'Select_the_contractor_you_wish_to_upd', lv_user_obj.sys_id);

               cart.setVariable(item, 'email', lv_current.variables.reqfor_email);

               cart.setVariable(item, 'change_end', lv_current.variables.change_end);

               cart.setVariable(item, 'contractor_name', lv_user_obj.name);

               cart.setVariable(item, 'contractor_email', lv_user_obj.email);

               cart.setVariable(item, 'contractor_department', lv_user_obj.department);

               cart.setVariable(item, 'contractor_supervisor', lv_user_obj.manager);

               cart.setVariable(item, 'contractor_location', lv_user_obj.location);

               var rc = cart.placeOrder();

               gs.log(rc.number + " should be an HRC number","AMP");

       }

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@katiyar_arpit 

see these links

How to Submit record producer using script ServiceNow 

Submit the record producer from script 

CatItem - Scoped 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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