diff --git a/Background Scripts/Get XML Of a Record/getRecordXML.js b/Background Scripts/Get XML Of a Record/getRecordXML.js new file mode 100644 index 0000000000..5c7e99845e --- /dev/null +++ b/Background Scripts/Get XML Of a Record/getRecordXML.js @@ -0,0 +1,22 @@ +function getRecordXML(tableName, sysId) { + var gr = new GlideRecord(tableName); // Replace 'incident' with your table name + gr.get(sysId); + var xmlDoc = new XMLDocument(); + var baseTag = xmlDoc.createElement('incident'); + var fields = gr.getFields(); + + var fieldNames = []; + for (var i = 0; i < fields.size(); i++) { + fieldNames.push(fields.get(i).getName()); + } + fieldNames.sort(); + + fieldNames.forEach(function(fieldName) { + var fieldValue = gr.getValue(fieldName); + var fieldTag = xmlDoc.createElement(fieldName); + fieldTag.setTextContent(fieldValue); + baseTag.appendChild(fieldTag); + }); + gs.info(xmlDoc.toString()); + return xmlDoc.toString(); +} diff --git a/Background Scripts/Get XML Of a Record/readme.md b/Background Scripts/Get XML Of a Record/readme.md new file mode 100644 index 0000000000..db182d2470 --- /dev/null +++ b/Background Scripts/Get XML Of a Record/readme.md @@ -0,0 +1 @@ +This function, getRecordXML, is a custom JavaScript function designed for ServiceNow to generate an XML representation of a record in any specified table. diff --git a/UI Actions/Open LIST UI Action/UIActionscript.js b/UI Actions/Open LIST UI Action/UIActionscript.js new file mode 100644 index 0000000000..735b6f2999 --- /dev/null +++ b/UI Actions/Open LIST UI Action/UIActionscript.js @@ -0,0 +1,10 @@ +function openinLIST() { + var taskTable = g_form.getTableName(); + + // Construct the hardcoded LIST URL + var listURL = '/' + taskTable + '_list.do?sysparm_clear_stack=true'; + + // Open in new window + var w = getTopWindow(); + w.window.open(listURL, '_blank'); +} diff --git a/UI Actions/Open LIST UI Action/readme.md b/UI Actions/Open LIST UI Action/readme.md new file mode 100644 index 0000000000..4ba977379e --- /dev/null +++ b/UI Actions/Open LIST UI Action/readme.md @@ -0,0 +1,2 @@ +This UI Action opens the LIST view for the current table in another tab. +UI action will run on Onclick openinLIST()