- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 02:21 PM
I need to pull a service catalog variable on "sc_req_item" table to email notification. I am reading that the variable first needs to be defined on email script before adding to the email notification which makes sense but I am not sure how to write the mail script. Can someone help me with this? The variable name is "Item_Requested". Thanks.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 12:12 PM
Thanks for all the responses back to my post. The request changed from adding just one variable to the notification to adding all variables on the catalog item to the notification. I used the mail script below to achieve that objective.
for (var key in current.variables) {
var v = current.variables[key];
template.print('\n' + v.getGlideObject().getQuestion().getLabel() + ": " + v.getDisplayValue() + " <br />");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 02:28 PM
You can create a mail script by navigating to System Notification->Email->Notification Email Scripts.
All you need to do is use template.print('My variable name is '+current.variables.<variable_name>). So in your case use current.variables.Item_Requested.
Then use the mail script in Notification. Below link should help
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 11:32 PM
Hi,
in gs.eventQueue()
you can pass current.variables.variable_name.
write below line in your script to trigger event and pass variable value.
gs.eventQueue(event_name, current, current.Variables.variable_name);
Mark Correct and Helpful .
Regards,
Manjusha Bangale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 12:12 PM
Thanks for all the responses back to my post. The request changed from adding just one variable to the notification to adding all variables on the catalog item to the notification. I used the mail script below to achieve that objective.
for (var key in current.variables) {
var v = current.variables[key];
template.print('\n' + v.getGlideObject().getQuestion().getLabel() + ": " + v.getDisplayValue() + " <br />");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2021 01:38 AM
Hello Tom,
This works perfectly fine, however i want to filter out variables of the type "Rich text Label" from the list.
Since it shows all the variables on the item , i just want to show the variables populated on requested item since some variables show only on conditions and filled accordingly using UI policies. How can i hide those in the notification as per the Variables filled for a item