We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to set custom view in email script URL

kalp
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
Kilo Sage

Hey @kalp 

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
Kilo Sage

Hey @kalp 

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.