Approve-Reject Button in Approval Notification - IT Service Management - Blog
Approve-Reject Button in Approval Notification - IT Service Management - Blog
Blog
These seems to be bringing more of standard user interface however, ServiceNow provides us
a functionality of mail scripts that can be customized & leverged to an extent so as to display
dynamic button/images instead of standard links which is also very simple to build.
b. Reject: email.button.reject.insert
3. Script include: renderMailtoButton
Script include above will help associating image (approve/reject), subject, body & recipient
which is called in the mail script.
renderMailtoButton is used to set below when Approve button is clicked.
To: (instance mail),
Subject: RE: RITM000000 approve
Body: I approve this request.
On click of Reject button from Approval mail below is set.
To: (instance mail),
Subject: RE: RITM000000 reject
Body: I reject this request.
To summarize, renderMailtoButton is used to open outlook mail directly with the values being
passed in Image, Subject, Body & recipient list.
4. Call the mail scripts in the notiAcation body (What it will contain) so as to make it work in
the format as below.
Dear ${approver.name},
Please approve or reject by clicking one of the buttons below and sending the email
${mail_script:email.button.approve.insert} ${mail_script:email.button.reject.insert
Output as below:
:
Hope it helps.
Thanks,
Jaspal Singh
Approve.PNG Reject.PNG
PNG PNG
10.12K 8.81K
Dear Jaspal,
Thanks for sharing code, this is deAnitely user friendly and customers were looking for. I have
replicated on my personal instance and it's working as mentioned in the blog.
Thanks,
Milind
:
" Helpful (2) # Comment
Roshani • 2y ago
R
Hi Jaspal ,
I am not able to get these button on notiAcation . Here is my code
:
" Helpful (0) # Comment
$ Show comments
Uma • 2y ago
U
Hi Jo
i have an requirement to create a database views based on cmdb_rel_ci table.
Current relationship records are stored as the following:
Parent = Environment, Type = Depends On::Used By, Child = Hardware
Parent = Business Application, Type = Depends On::Used By, Child = Environment
Create a Database view joining cmdb_ci_appl, cmdb_ci_business_app,
and cmdb_ci_environment based on cmdb_rel_ci relationships.
i have created below Database view.after adding 4th table its giving empty records.
:
do you have any idea how to get all the relationship data means from app to env and env to
server. i need to get all the data.
let me know if you have any idea.
Thanks in advance.
Michael • 2y ago
Hi Jaspal,
This is great! Thank you for sharing this. We found one issue however during our testing. I'm
hoping you can correct/update your steps above as it could lead to unintended approvals.
For step:
b. Reject:
Reject: email.button.reject.insert
You have:
var response = "approve";
Should be:
var response = "reject";
Thanks,
Michael
$ Show comments
Is there a way to force a carriage return / newline int he email body? It runs the watermark right
up against the 'I approve' message in the email body:
:
" Helpful (0) # Comment
$ Show comments
Freddy • 2y ago
F
Hi @Jaspal Singh ,
how can I change the body of the email on this script to use email template?
I want the message as per below to be once the user click approve or reject. Is it possible to do
so?
==============================================================
Please do not modify the subject of this email. Click 'Send' to automatically approve this
request.
Comments can be added below.
Dear "User"
This request has been approved by:
"Manager"
Comments (Customer visible):
WHAT HAPPENS NEXT:
Service Desk will be in touch once this request has been actioned.
==============================================================
:
" Helpful (1) # Comment
$ Show comments
Hi @Jaspal Singh ,
Would you know how to get the response email to go to sysapproval_approver table?
When the user reply with subject line Re:creq12323 - Approve, the response goes to the ticket
itself.
Thanks so much in advanced.
Hi, it would be possible to add a third option? Instead or Approve or Reject add a new option
Review (This option would re-open a task)
$ Show comments
$ Show comments
Hi @Jaspal Singh
I have the similar type of requirement but it don't have any approvals and all.
For a case when an assigned to a Group there a notiAcation will be sending that will contain
"Accept" or "Reject" buttons on-click of let's say "Accept" then it should open seperate mail box
as shown above by you and that message in the body should get updated in the Additional
comments Aeld on the case.
Note : I used your script as is and uploaded images in system ui but it's not displaying the
buttons on the notiAcation body?
:
What changes i should make to get proper output here?
Anyone suggest would help a lot
Thanks in Advance
Balaraju
$ Show comments
We can do without reply email. When we click Approve and reject button . Incident should be
open and close.can we do without reply mail??
Hi Jaspal,
The article is very helpful, but I get output as
Subject :-Re:RITM0010710+reject
Email body :-I+reject+this+request. In both scenario,Can you please tell me why + sign is occure
$ Show comments
I am not an expert in ServiceNow. I used all information here including every commenter's script
and screenshot.
:
Following Malani Arjun's Screenshot, the include script is wrong. I wasted 3 hours solving this.
Conclusion:
Remove this code that is automatically injected by ServiceNow when you create new Include
Script.
type: 'renderMailtoButton'
};
Just directly insert below into the included script.
Gagan • 6d ago
G
Dear Jaspal,
This is a great article and works perfect!! Thank you.
:
Regards,
Gagan k
:
Help
Terms of Use
Privacy Policy
Cookie Preferences
Trademark and Branding
ServiceNow Support
Knowledge Base