Business Rule script to create link in journal input field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2017 08:39 AM
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-
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2017 08:52 AM
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();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2017 08:53 AM
There's also some code by Jace out on share that might help you in the future: ServiceNow Share