- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2023 09:26 PM
Hello All,
I have a problem with approving/rejecting a Approval request using email notification.
When the 1st approver click the hyperlink "Click here to Approve/Reject", it will open and redirected to the approval form.
when the 2nd and 3rd approver click the same link, it will open and redirected to the approval form but under the 1st approver view or name.
Please help to check and correct my existing email script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var baseURL = '';
baseURL = "https://" + gs.getProperty('instance_name') + ".service-now.com/sysapproval_approver.do?sys_id=" + current.sys_id;
template.print('<a style="font-family: verdana; font-size: 14px;color: blue;" href=' + baseURL + '>Click here to Approve/Reject</a><br />');
})(current, template, email, email_action, event);
The link should be open and redirected under for each approver not only under the 1st approver.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2023 11:26 PM
your approval email notification should be on sysapproval_approver so that it sends 3 different emails for each of those 3 approver users
Condition: current.source_table == 'pm_project_task'
you can access the task fields using dot walking and show in email body
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2023 11:26 PM
your approval email notification should be on sysapproval_approver so that it sends 3 different emails for each of those 3 approver users
Condition: current.source_table == 'pm_project_task'
you can access the task fields using dot walking and show in email body
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 04:18 PM
Hello @Ankur Bawiskar ,
How can i show the description in the email body from pm_project_task table via dot walking?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 07:41 PM
if dot walking doesn't work you can get project task sysId and query the table and get field values
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2023 11:29 PM
Hello @Ankur Bawiskar ,
i want to print the current project task number on the email body but my script is not working.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var ptaskNumber = new GlideRecord('pm_project_task');
ptaskNumber.addQuery('number', current.sysid);
ptaskNumber.query();
if(ptaskNumber.next()){
template.print(ptaskNumber.getDisplayValue());
}
// Add your code here
})(current, template, email, email_action, event);
Could you please help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2023 11:38 PM - edited ‎01-24-2023 11:38 PM
Hello @Ankur Bawiskar ,
I got it already by adding 'task.number', current.sysid
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var ptaskNumber = new GlideRecord('pm_project_task');
ptaskNumber.addQuery('task.number', current.sysid);
ptaskNumber.query();
if(ptaskNumber.next()){
template.print(ptaskNumber.number.getDisplayValue());
}
// Add your code here
})(current, template, email, email_action, event);