Help with Record Producer script

jlaue
Kilo Sage

Hello - 

I am trying to get a Service Catalog Record Producer.  I need to insert a record into 2 other tables with variables from the record producer.  I have included what I thought may work, but unfortunately is not working.  I am not sure if this is even possible to do it this way from within the Record Producer script box.  Here is what I have, any help is greatly appreciated!

 

//add the Vendor Contact
var gr = new GlideRecord('vm_vendor_contact');
gr.initialize();
gr.name = current.variables.contact_name;
gr.type = current.variables.type;
gr.primary_phone = current.variables.office_phone;
gr.alternate_phone = current.variables.mobile_phone;
gr.fax = current.variables.contact_fax;
gr.title = current.variables.title;
gr.address = current.variables.address;
gr.email = current.variables.email;
gr.company = current.variables.name;
gr.insert();


//add NDA Contract
if (current.variables.request_a_nda == 'yes'){

var gr = new GlideRecord('ast_contract');
gr.initialize();
gr.u_requested_for = current.variables.requested_for;
gr.contract_model = current.variables.contract_model;
gr.short_description = current.variables.brief_description;
gr.vendor = current.variables.name;
gr.insert();

}

 

 

Thank you!

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Just tested and confirmed: producer.your_var_name works fine. gr.insert() is also no issue. I just created an Incident (thru the Record Producer) and a Change Request (thru the Script).

find_real_file.png

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

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

View solution in original post

6 REPLIES 6

Mark Roethof
Tera Patron
Tera Patron

Just an additional note. I noticed:

if (current.variables.request_a_nda == 'yes'){

If your request_a_nda variable is of type Yes/No, then use first letter uppercase: 'Yes'.

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

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

jlaue
Kilo Sage

Thanks for the help!  That did it!