Business Rule script to create link in journal input field

matthew_magee1
Giga Guru

Hi all,

I have a business rule that creates an entry into a journal input field when an PRI 1 or 2 INC ticket is created.

What I want the entry to include is a link to the INC created

I tried something like this:

var link = '<a href=" ' + gs.getProperty("dns.url") + 'uri=incident.do?sys_id=' + current.sys_id + ' ">blah</a>';

gs.field_name = link;

All i get in return is: <a href=" ' + gs.getProperty("dns.url") + 'uri=incident.do?sys_id=' + current.sys_id + ' ">blah</a>

I did come across this wiki page: Render journal field entries as HTML

But this only appears to work if I'm adding text in the journal field itself, not from the business rule.

Any help is greatly appreciated-

2 REPLIES 2

matthew_magee1
Giga Guru

Figured it out with a little trial and error:


var gr = new GlideRecord('table_name');


gr.addQuery(blah);


gr.query();


while(gr.next()) {


gr.field_name = '[code]'+'<a href=" ' + gs.getProperty("dns.url") + 'uri=incident.do?sys_id' + current.sys_id ' ">'+current.number+'</a>[/code]';


gr.update();


There's also some code by Jace out on share that might help you in the future: ServiceNow Share