I want the hrcase number as clickable link in additional comments

Rutusha
Tera Contributor

Hi all,

I have a requirement where I need clickable link in the comments section of HRcase.

I tried below but its not working.

Could some one please help here.

var gr = new GlideRecord('sn_hr_core_case');
gr.addQuery('number','HRC989999');
gr.query();
if(gr.next()){
    var hrCaseId = gr.sys_id;
    var hrCaseNo = gr.number;
    var url = '[code]<a href ="https://XXX.service-now.com/hr_agent_workspace?id=sn_hr_core_case_workforce_admin&sys_id='+hrCaseId+ '" target="_blank">' + hrCaseNo+ '</a>[/code]';
    //gr.comments = '<a href="'+url+'">'+hrCaseNo +'</a>';
    gs.print('comment is' +url);
}
1 REPLY 1

SP22
Mega Sage
Mega Sage

Hi @Rutusha ,

Please find the below modified script can you please have a look and let me know whether it is working or not.

var gr = new GlideRecord('sn_hr_core_case');
gr.addQuery('number','HRC989999');
gr.query();
if(gr.next()){
var hrCaseId = gr.sys_id;
var hrCaseNo = gr.number;
var url = '[code]<a href ="https://XXX.service-now.com/hr_agent_workspace?id=sn_hr_core_case_workforce_admin&sys_id='+hrCaseId+ '" target="_blank">' + hrCaseNo+ '</a>[/code]';
gr.comments = '<a href="'+url+'">'+hrCaseNo +'</a>';
gr.update();
//gs.print('comment is' +url);
}
Thanks
SP.