how to create a hyper link to insert into work notes of incident???

KM SN
Tera Expert

Its hunting since from beginning, if anyone can explain how to frame a link dynamically.

I am able to print the short description and article number from the script include only issue is I am failing to insert a link with name as combination of kb number & kb short description??

Its been throwing error just to save itself .

 

 

        var kba = gs.getProperty("KB articles");
        var kabArray = kba.split(',');
        var inprogressID = kabArray[0];
        var resolvedID = kabArray[1];
        var state = current.getValue('state');

        if (state == '2') {
            var kbscript_include = new decidekbarticleoncase();
            var kb_result = kbscript_include.getkbdetails(inprogressID);
            gs.addInfoMessage('kb number is :' + kb_result.number + "and Kb name is :" + kb_result.shortdescription);

            current.work_notes = [code]<a href="https://dev263124.service-now.com/kb_knowledge.do?sys_id="+kabArray[0]>kb_result.number </a>[/code];
        }
           

 

 

 

2 ACCEPTED SOLUTIONS

Then you need to create variables for it, based on your requirements.

 

var kb = current.knowledge_article;

var sys_id = query to the sys_id of your article;

var url = 'https://your_url.service-now.com/now/nav/ui/classic/params/target/kb_knowledge.do%3Fsys_id%3D' + sys_id;

 

then you can just make it [code]<a href=" + url + ">' + kb + '</a>[/code]

My PDI is sleeping, so I can't validate the exact code, but it should work, something like this.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

View solution in original post

Mani A
Tera Guru

 

            var kb= 'https://your-instance.service-now.com/kb_knowledge.do?sys_id=' +knb.sys_id

            var link = knbNumber + ' - ' + knbShortDescription;( this should be ur script include data)

            var htmlLink = [code]<a href="' + kb+ '" target="_blank">' + link + '<a>[code]

View solution in original post

4 REPLIES 4

Mark Manders
Mega Patron

Check this blog: https://www.servicenow.com/community/in-other-news/formatting-within-journal-fields-using-html-amp-c...

 

One note: it could be that usage of formatting within work notes/comments is turned off for security reasons. In that case using anything with [code][/code] won't work.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Thanks @Mark Manders  for your reply.!!
I am trying in my personal developer instance itself.

when I used [code]<a href="https://www.servicenow.com">ServiceNow.com</a>[/code] its populating servicenow link into worknotes as shown below

kb-2.png


but I want to make it dynamic. here I am facing issues with framing link itself.

 

I want to populate a link with kb short description & number that i am getting from script include.

Then you need to create variables for it, based on your requirements.

 

var kb = current.knowledge_article;

var sys_id = query to the sys_id of your article;

var url = 'https://your_url.service-now.com/now/nav/ui/classic/params/target/kb_knowledge.do%3Fsys_id%3D' + sys_id;

 

then you can just make it [code]<a href=" + url + ">' + kb + '</a>[/code]

My PDI is sleeping, so I can't validate the exact code, but it should work, something like this.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Mani A
Tera Guru

 

            var kb= 'https://your-instance.service-now.com/kb_knowledge.do?sys_id=' +knb.sys_id

            var link = knbNumber + ' - ' + knbShortDescription;( this should be ur script include data)

            var htmlLink = [code]<a href="' + kb+ '" target="_blank">' + link + '<a>[code]