Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ServiceNow background script to check import transform map choice actions
//change to sysid of app you want to scan
var appID = "e32a61c94f198a004f167d2ca310c72a";
function reviewTransformChoiceActionsForApp(appId) {
var entry = new GlideRecord("sys_transform_entry");
entry.addQuery("sys_scope", appId);
while ( {
targetTable = entry.getValue("target_table");
targetField = entry.getValue("target_field");
var choiceFieldType = getChoiceFieldType(targetTable, targetField);
if (!choiceFieldType)
continue;"{0} - {1}.{2} ({3}), {4}",, targetTable, targetField, choiceFieldType, entry.getValue("choice_action"));
function getChoiceFieldType(table, element) {
var gr = new GlideRecord(table);
var el = gr.getElement(element);
var internalType = j2js(el.getED().getInternalType());
if (internalType == "reference")
return "reference";
if (internalType == "choice" || (internalType == "string" && j2js(el.getChoices()).length > 0)) {
return "choice";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.