How to submit the Record producer using Script

ramesh_r
Mega Sage

Hi All,

Is this possible to submit the Record Producer from the script .? if ye kindly provide the sample script or any sample

 

 

Thanks

Ramesh R

 

 

1 ACCEPTED SOLUTION

Carlos Candano
Mega Guru

Hi Ramesh

Your Raw value needs to be enclosed inside the variables object.

ex. {'variables':{'description':'description','short_description':'short_description'}}

View solution in original post

14 REPLIES 14

Mark Roethof
Tera Patron
Tera Patron

Hi there,

What script do you have in mind? Can you clarify?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi

 

The below script will use to submit a normal catalog.

I want a script like this to submit Record producer...

var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
 //add your requested item to the cart by sys_id of the catalog item
var item = cart.addItem('4054428fdb151f0097679ec6db9619c0', 1);

//fill in the variables on the request item form
cart.setVariable(item,"u_requested_for", "e80edd6edbec6bc097275e25ca9619a4"); 
cart.setVariable(item,"contact_number", "0");
cart.setVariable(item,"assignment_group", "87ec1c342b2e71406c487fb5a8da1524"); 
cart.setVariable(item,"application_service", "cdedfbcedb0f9744c291c170ba9619a7");
cart.setVariable(item,"short_description", email.subject);
cart.setVariable(item,"description", email.body_text);
var rc = cart.placeOrder();

 

TzachB
Giga Contributor

Hey,

You can try in left panel "rest api explorere", than change the namespace to "sn_sc". 

Now you should find "submit a record producer" , populate the relevant RP  sys_id and build your request body according to the RP variables.

In the final step go down to end of the page and generate your script (servicenow script).

Hi @TzachB 

I can able to submit the record producer by using the given option but variables not set in the target record

 

Thanks

Ramesh R