Record producer data to Incident description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2016 11:46 AM
I have created a record producer that will gather some information and create an incident. I have then created a template to fill out some of the standard incident fields. What I am having a problem with is that once the user completes the form the incident will be created but none of the information they entered appears anywhere. Ultimately I would like all of their entered field information to appear in the description field of the created incident but can't figure out how to get that to happen.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2016 12:36 PM
In the script field of the record producer, you can add something like: current.description = producer.variablename + ' , ' + producer.variablename2;
Do that for all your variables and the data entered should end up in the description field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2016 08:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2016 09:14 PM
The template will work fine, please post the template that you have created
The variables in the record producer can be accessed by producer.variable
Record Producer - ServiceNow Wiki
Wiki has an exclusive article to create incident through record producer -
Creating a Record Producer to Log Incidents - ServiceNow Wiki
Mark if it is helpful or correct, feedback is appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2016 01:45 AM
Thanks for that - I found the following in an article (unable to find it now) where I copied the following into the record producer script field and it worked0:
- var test = [];
- for(var v in producer) {
- if (v.startsWith("IO")) {//only variables
- var question = new GlideRecord('item_option_new');
- question.get(v.substring(2)); // Querying by sys_id to determine question text
- test += question.question_text + ": " + producer[v] + "\n"; // Set key:value pair to variable
- }
- }
- current.work_notes = test; // Set Work Notes on new record
However, this shows all variables whether they were selected or not. What coding do I need to do to only show variables that have been selected.
I tried to add the following between line 3 and 4 but it did not help (this is from my email script that works)
- if(v.get(i).getDisplayValue() != 'No' && v.get(i).getDisplayValue() != 'false' && v.get(i).getDisplayValue() != '' && v.get(i).getDisplayValue() != "-- None --"){
Any thoughts or suggestions would be appreciated
Cheers