link to record in email notification creates new record

leesha
Tera Contributor

Hi all,

I   have been left debugging an app implemented on our previous SME's last day and have run out of places to look based on my limited knowledge for the following problem.

The link to a specific record included in email notifications to the submitter opens the form for a new record in ESS rather than the required record.

The reference in the notification is ${CMS_URI+ess/x_table}. The URL of the displayed page appears to render correctly and includes the sys_id of the required record but opens a new record instead.

x_table does not have a page defined in Content Management, but is the name of the relevant table. When the record is accessed through ESS its URL does include x_table.do though.

Is this likely to be the cause or could there be something else?

We have many other notification links working perfectly, however they do all reference specific pages.

Thanks for any assistance.

4 REPLIES 4

amlanpal
Kilo Sage

Hi Leesha,



You can create a new Email Script navigating System Notification-->Email-->Notification Email Script as below and use it in your email notification Message body.


var tbl = current.sys_class_name;


var sysID = current.sys_id;


var link = createLinkForObject(tbl,sysID);


template.print(link);


function createLinkForObject(strTableName, strSysID){


  return '<a href="'   +'/x_table.do?sys_id=' + strSysID+'&sys_class_name='+strTableName+'">${number}</a>';


}



Once you are done with this, you need to call the email script in your email notification. For technical guidance please refer this ServiceNow Document: Scripting for email notifications.



I hope this helps. Please mark correct/helpful based on impact


Hi leesha ,



Were you able to have a look at my response? May I know the Status of this thread? If your issue is been resolved, please mark the relevant answer correct and close the thread. Or else, please feel free to reach us for any clarification/assistance.


leesha
Tera Contributor

Apologies amlanpal,


Unfortunately in this instance your assistance did not fix our issue. But thanks for taking the time.


Kalaiarasan Pus
Giga Sage

Does the link include any other parameter other than table.do? If not, that is the likely cause.