- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2019 12:29 PM
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!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2019 12:42 PM
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).
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2019 12:47 PM
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
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2019 12:53 PM
Thanks for the help! That did it!