Add Record Producer Variables in email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2014 12:42 PM
I created a Record Producer with a couple of questions. I created a email notification to trigger on submission and I would like to know how I can include the answers to the variable questions. I've tried a few scripts from posts in the forums where users had a similar issue, however I cant seem to get the logic correct to have the variables show as they aren't visible in the select variables section on the right hand side of the notification message. I tried the links below and a couple of others. So far all I get is a blank notification.
Showing Request Item / Catalog Variables in Mail Script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2014 01:21 PM
what code are you running?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2014 02:19 PM
Any of the codes in the links I posted. I copied and pasted into my notification message, but I don't know enough about scripting to know which lines to change and then to reference my variables in the email body

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2014 02:32 PM
I am not sure how to help you without seeing what code your are running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2014 03:02 PM
Here is the code i put in the notitication. I plan on taking a scripting class within the next few months and will be attending the knowledge14 conference in May.
template.print('Requested Item Details:\n');
template.print('\n');
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
var currentVar = vs.get(i);
if (currentVar.getDisplayValue() != 'false' && currentVar.getDisplayValue() != '' && currentVar.getDisplayValue() != '-- None --') {
template.print('\n');
}
}
template.print('
if (currentVar.getDisplayValue() == 'true') { template.space(2); template.print(' colspan="2"'); } template.print('>'); template.print(currentVar.getLabel()); if (currentVar.getDisplayValue() != 'true') { template.print(' | '+ currentVar.getDisplayValue()); } template.print(' |
\n');