Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to set custom view in email script URL

kalyani23
Tera Contributor

Hi,

I want to set/display custom view , I have given url in email script for sysapproval_approver form. When i click url in the email notification, it is directing to the default view, how can i make the user to redirect it to the custom view created for approval table .

below is the code i have added for providing url ,please let me know where and how to include the custom view  name here. 

var str = "<a href =\"https://" + gs.getProperty('instance_name') + ".service-now.com/nav_to.do?uri=%2Fsysapproval_approver.do%3Fsys_id%3D" + current.sys_id + "\">" + URL + "</a>";

 

Thanks & Regards,

Kalyani

1 ACCEPTED SOLUTION

Oliver Stammler
Tera Guru

Hey @kalyani23 

you have to add the view to the URL by using "sysparm_view=<name of the view>".
So in your example this could be: <a href =\"https://" + gs.getProperty('instance_name') + ".service-now.com/nav_to.do?uri=%2Fsysapproval_approver.do%3Fsys_id%3D" + current.sys_id + "%26sysparm_view=viewname\">

Best regards
Oli

View solution in original post

2 REPLIES 2

Oliver Stammler
Tera Guru

Hey @kalyani23 

you have to add the view to the URL by using "sysparm_view=<name of the view>".
So in your example this could be: <a href =\"https://" + gs.getProperty('instance_name') + ".service-now.com/nav_to.do?uri=%2Fsysapproval_approver.do%3Fsys_id%3D" + current.sys_id + "%26sysparm_view=viewname\">

Best regards
Oli

Thank you for providing the solution, i have tried it and is working as expected.