ServiceNow UI Action to display messages with redirect URLs in the message
(see also http://www.cloudminus89.com/2020/09/add-hyperlink-to-work-notes-activity.html )
example - clickable links in the gs.addInfoMessage:
important to use target="_blank" in the <a> tag in order for it to work
var si = new global.testPolling();
var res = si.retrieveDetailedErrorLogs(current);
//gs.addInfoMessage('RESULT=' + res);
if (!gs.nil(res)) {
var instURL='https://'+gs.getProperty('instance_name') + '.service-now.com';
var arrRes = res.split(',');
var url1 = instURL+'/nav_to.do?uri=u_integration_alerts.do?sys_id=' + arrRes[0];
//var url1 = '/nav_to.do?uri=u_integration_alerts.do?sys_id=' + arrRes[0];
var link1='<a target="_blank" href="' + url1 + '">TASK INSTANCES</a>';
gs.addInfoMessage('click here to access integration alert entry:\n'+link1);
if (arrRes.length > 1) {
var url2 = instURL+'/nav_to.do?uri=u_integration_alerts.do?sys_id=' + arrRes[1];
//var url2 = '/nav_to.do?uri=u_integration_alerts.do?sys_id=' + arrRes[1];
var link2='<a target="_blank" href="' + url2 + '">ERROR LOG DETAIL</a>';
gs.addInfoMessage('click here to access integration alert entry for:\n'+link2);
}
}
action.setRedirectURL(current);
Comments
Post a Comment