Skip to main content

Posts

Showing posts from December, 2024

ServiceNow Process an excel file attached to a fix script

 Process an excel file attached to a fix script main(); function main() { var excelDataJSON = this .getData(); if (excelDataJSON == null ) { gs.info( "No data in the excel file" ); return ; } this .processData(excelDataJSON); } function processData(excelDataJSON) { excelDataJSON.forEach( function (row) { var approle = row.application_role; var upn = row.upn } } function getDataFromAttachedExcelFile(grAttachmentSysId) { var myobjArray = []; var attachmentSID = grAttachmentSysId; // pass your excel attachment sys_id var parser = new sn_impex. GlideExcelParser (); var attachment = new GlideSysAttachment (); // use attachment sys id of an excel file var attachmentStream = attachment.getContentStream(attachmentSID); parser.parse(attachmentStream); while (parser.next()) { var row = parser.getRow(); var myData = ...

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

 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 int...