The CreatorCon Call for Content is officially open! Get started here.

Click Approve/Reject on email Notification

Al-jhon
Kilo Sage

Hello All,


I have a problem with approving/rejecting a Approval request using email notification.

Aljhon_0-1673328012194.png


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.

Aljhon_1-1673328249419.png


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.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Al-jhon 

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

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

19 REPLIES 19

@Al-jhon 

I don't think it would work

you are comparing number against sysId in this line

ptaskNumber.addQuery('task.number', current.sysid);

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar , ahhh i think that's why im getting wrong displayValue.

let me re-work on the code.

@Al-jhon 

Sure.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello @Ankur Bawiskar can you please help how can i get the number of the current project task number based on my codes? It's displaying wrong value. Thank you

@Al-jhon 

please share your latest code which you are using

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader