Approve and Reject button on email

Roshani
Tera Expert

Can somebody help me to create Approve and Reject Button on email notification and on click of approve new email should get populated. How can we achieve this functionality. 

 

 

3 REPLIES 3

asifnoor
Kilo Patron

Hello Roshani,

There is already an existing OOTB notification (check Approval request notification) which gives you links to approve and reject. Check how it works.

And in place of link, you can place mailto with your instance mail address so that a mail dialog opens when click on approve or reject.

Then you have to write an inbound action to handle the incoming mail and based on the subject, you either have to approve or reject.

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

 

Service_RNow
Mega Sage

Hi,

Check out the OOB "Update Approval Request" inbound action.   All that it is doing is checking the email.subject for the word approve or reject.   The links in SN for approvals are mailtos, auto generated reply emails, that have either approve or reject in the subject.   If you want this rule to include reply emails that have approve or reject in the body just edit the following 2 lines:

------

 

if (email.subject.indexOf("approve") >= 0)

current.state = "approved";

if (email.subject.indexOf("reject") >= 0)

current.state = "rejected";

-----

if (email.subject.indexOf("approve") >= 0 || email.body.indexOf("approve") >= 0)

current.state = "approved"; 

if (email.subject.indexOf("reject") >= 0 || email.body.indexOf("reject") >= 0)

current.state = "rejected";

Screen Shot 2017-11-30 at 4.28.10 PM.png

 

 

 

That should do what you are looking for.

AbhishekGardade
Giga Sage

Hello Roshani,

 

I can you already have posted same question and you got the answers as well from community members.

https://community.servicenow.com/community?id=community_question&sys_id=f7e48187db668c54d58ea345ca96...

Please continue with the same thread that you opened already. It wont help you by creating duplicate thread/ questions.

 

Thank You!
Abhishek Gardade
ServiceNow MVP 2020

Thank you,
Abhishek Gardade