how to send approval notification out of servicenow and approve it from the same notification only?

Prathamesh Chav
Tera Contributor

Hi Team, 

 

I want to send notification and there it will have two button approve/reject. manager should able to approve and reject it from the same notification, and hence he/she dont need to login servicenow for approve/reject.

can anyone help me in this?

 

Thanks

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Prathamesh Chav 

 

https://www.servicenow.com/community/developer-forum/how-to-approve-or-reject-a-record-through-email...

https://www.servicenow.com/community/itsm-articles/approval-emails-in-servicenow/ta-p/2308603

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG ,

Those links are not working can you simply provide me the steps and any OOTB links for functionality available for this?

 

HI @Prathamesh Chav 

 

Links are working for me

 

ServiceNow is doing great work in enabling enterprise digital transformation. To make sure that the work gets done 'the right way', approvals are required. In ServiceNow, we have the opportunity to not only digitize the approval process but also automate it. It's time to explore the process of configuring approval emails.

A case study approach to understanding approval notification in SN!

Let's say you have to configure an approval in a way that, when users place a request from the portal, their manager needs to approve at RITM level.

Here is the constraint, "you cannot alter the already configured workflows".

How will you go about it??

A notification can be triggered:

  1. By calling the notification itself (Using Server Side scripts)
  2. When an event is fired
  3. When a record is updated/ inserted in a table. (Most convenient)

We can use any of them, but for now, I will stick to option 2. It helps us get a better understanding of events, OOB scripts, notifications, and a bunch of important tables in SN.

But first, let's understand the end2end journey of approval!

AGLearnNGrow_0-1734702703724.jpeg

 

 

So if you follow the steps given in the image, you should nail the approval email. But for our case, it isn't sufficient!

Why?

We are trying to get approval at RITM level, but the OOB 'Approval Events' script can only process 'request', sc tasks and standard change. It can't process RITM, so no event would be logged for RITM approval record. (We need an event to be logged so that a notification linked to that event will be triggered)

This small piece of code will do the magic! Add it in the Approval Events (Task) BR.

You will also need to plug a line of code to fire the event.

 // snippet starts here

function checkReqItem() {

var task = current.sysapproval.sys_class_name || current.source_table;

return (task == 'sc_req_item');

}

// spinnet ends here

If you haven't configured the event yet, you can simply go to 'System Policy > Event > Event Registry' and register a new event. You can name it 'ritm.approval.request' and use the same name in the Approval events BR to fire it.

Now link the event to the notification record. You can do this by going to the notification record, then setting the send when to 'event is fired' and add the event name as 'ritm.approval.request'.

Finally, configure the dynamic notification email, the way you want it!! Alternatively, you can also attach an email template here!

Now every time a user requests an item from Service Portal, their manager would get the approval request at RITM level. We achieved this without altering any workflow.

That's all. 

Before signing off, here is a table of elements discussed in the article.

# Name of element Type Remarks
1 sysapproval_approver Table It stores the approval generated from approval activity.
2 Approval Events (Task) BR Processes the records in the approval table and fires events
3 sysevent_register Table Keeps record of important events, which can be actioned upon (if need)

 

 

Happy learning.

Would love to improve this article with your suggestions!
Thanks!

Rohan Raj
Find me here: https://www.linkedin.com/in/rohanrajnow/

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Dr Atul G- LNG
Tera Patron
Tera Patron

You can   write inbound actions for to approve or reject through emails.



In inbound actions you can specify   the conditions like subject contains, field ...etc.



Depending upon the conditions it will update on the target table.



By using watermark service now instance will identify to update that on which record.



Refer the below links may helpful to you

 

.Approve or Reject Change Request via Email



Single click on email link to accept/reject a record



Buttons within Email Notifications

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************