- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2020 11:22 PM
Hi,
Is it possible to create a custom approval notification based on the service catalog item?
Ex:
The workflow for the catalog item XXXX Form includes an approval. When the approval is generated, I want to include the fields in the catalog item in the approval notification that is sent, including the Approve and Reject buttons.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2020 02:53 AM
Hi,
For RITM fields you can use this
Example below
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print('Catalog Item: ' + current.sysapproval.cat_item.name);
})(current, template, email, email_action, event);
For printing RITM variables use this
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print('RITM Variables: <br/>');
var variables = current.sysapproval.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion();
var label = question.getLabel();
var value = question.getDisplayValue();
if(label != ''){
template.space(4);
template.print(' ' + label + " = " + value + "<br/>");
}
}
})(current, template, email, email_action, event);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2020 11:29 PM
Hi Gopal,
You can create custom approval notification for your specific catalog item. Ensure it runs only for your catalog item.
Advanced Condition:
answer = checkCondition();
function checkCondition(){
if(current.sysapproval.cat_item.name == 'Your Catalog Item Name')
return true;
else
return false;
}
Ensure the OOB doesn't trigger for your catalog item
Advanced Condition:
answer = checkCondition();
function checkCondition(){
if(current.sysapproval.cat_item.name != 'Your Catalog Item Name')
return true;
else
return false;
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2020 01:28 AM
Hi Ankur,
How can I get the fields(catalog item) in the Notification?
Can I write the notification on the Catalog item table.
Can you explain more?
Thanks
Gopal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2020 01:41 AM
Hi,
Since you want approval notification you would require notification to be created on sysapproval_approver table
There is out of the box approval notification on that table
Ensure you add condition in it so that it doesn't trigger when approval gets generated for your catalog item or else 2 notifications would be sent. one is OOB and other is your newly created
Also ensure your new notification runs only for your catalog item and not others
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2020 02:40 AM
Hi,
Thanks, However how can I add catalog item fields in Notification(Message HTML) in the approval table.