How to use sysparm_view in the notification to get our desired view of the form?

pallavikavuluru
Kilo Contributor

Hi,

          In our scenario there is a link that opens the task form in the notification email. Whenever we click the link the default view of the task form is being opened. Our requirement is "the form should appear in our desired view". For that we have created a view on the task table.

We have tried many ways to get the desired view using URI , URI_REF, URL

We have selected the 'Content Type' in the notification as "HTML and plain Text"   and have added the below line (which is mentioned in WIKI) in the Message

Click here to view the task: ${URI+sysparm_view=BA_Termination_Task}

The hyperlink appears in the mail as

https://dev12880.service-now.com/nav_to.do?uri=sc_task.do%3Fsys_id=e41e76450f564200c3da306be1050e40s...

we have also tried with

Click here to view the task: ${URI+&sysparm_view=BA_Termination_Task}

This appears as

https://dev12880.service-now.com/nav_to.do?uri=sc_task.do%3Fsys_id=e41e76450f564200c3da306be1050e40%...

Nothing worked.   Can anyone suggest any solution to this?

10 REPLIES 10

catchdini
Tera Expert

Hi Pallavi,



Create a new email notification script and use the below 2 lines in that. What I am doing here is setting the General view for the incident, when the user clicks the link in the email he receives.



var url = gs.getProperty("glide.servlet.uri") + 'nav_to.do?uri=incident.do?sys_id='+current.sys_id+'%26sysparm_view=general'; //Here the General view is used


template.print('<a href="' + url + '">' + current.number.getDisplayValue() + '</a>');



Give the script a name and then go to the notification and include ${mail_script:name of the notification script} in the place where you want to use.



This will definitely work as I use this in my instance. let me know for any issues.