logo

NJP

ServiceNow UI Action to display messages with redirect URLs in the message

ServiceNow Blog · Dec 09, 2024 · article

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 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='TASK INSTANCES';

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='ERROR LOG DETAIL';

gs.addInfoMessage('click here to access integration alert entry for:\n'+link2);

}

}

action.setRedirectURL(current);

View original source

http://www.cloudminus89.com/2024/12/servicenow-ui-action-to-display.html