Email script help to open link record

kalava
Giga Contributor

Hello Community,

Can any one help below requirement.

I want to display the number in notification body through email script and if i click that number it should be open form view same record and i dont want to open in service portal.

anyone help me with the script it's highly appreciated.

Thanks,

Ramesh kalava

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hi

In your script you can do simply like this

var attachLink = '<a href="/incident.do?sys_id='+current.sys_id+'">' + current.number + '</a>'; //put your table name

template.print(attachLink);

View solution in original post

26 REPLIES 26

Sudhanshu Talw1
Tera Guru

Means you want to open in the backend form table?

Is it right?

If that is the case, create your URL wherever you want to redirect

var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=' + current.sys_class_name + '&sys_id=' + current.sys_id + '">${number}</a>';  
template.print(url);  

Thanks

Sudhanshu

Kieran Anson
Kilo Patron

Hi,

You can use the following variable which will insert a link with the display value of the record (which is most likely the number) 

${URI_REF}

Hi Kieran,

Exactly i am looking for this if i place this in body it will work and i want to achive same functionality through email script.Could you please help me with email script to achive this

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          // Add your code here
	var recordlink = current.getLink();
	var prefix = gs.getProperty('glide.servlet.uri');
	var url = prefix + recordlink;
	var displayvalue = current.number;
	template.print('<a href="' & url & '">' + displayvalue +"</a>")

})(current, template, email, email_action, event);