Skip to content

Instantly share code, notes, and snippets.

@johncaruso
Created October 15, 2018 19:40
Show Gist options
  • Select an option

  • Save johncaruso/5137c9a2ebd0022fdba0edce47ed7a54 to your computer and use it in GitHub Desktop.

Select an option

Save johncaruso/5137c9a2ebd0022fdba0edce47ed7a54 to your computer and use it in GitHub Desktop.
Fixes issues when using "Track in Update Sets" UI action on custom scoped app table.
/**
* Fixes issues when using "Track in Update Sets" UI action on custom scoped app table.
*
* Per https://community.servicenow.com/community?id=community_question&sys_id=760fb629db58dbc01dcaf3231f9619bd
* a temporary table with a prefix of rep$x_ may be added to your app scope.
*
* As of Kingston, table columns get created in app scope but the table does not.
*
* @param {string} tableName
*/
function fixTrackInUpdateSets(tableName) {
/**
* Move table with prefix rep$x_ to global scope (if added to scoped app)
*/
// var grTable = new GlideRecord('sys_db_object');
// grTable.get('8efd12900f904300abfedb0be1050ef7');
// grTable.sys_scope = 'global';
// grTable.update();
/**
* Move rep$x_ table's columns to global scope
*/
var grField = new GlideRecord('sys_dictionary');
grField.addQuery('name', tableName);
grField.query();
while (grField.next()) {
grField.sys_scope = 'global';
grField.update();
}
}
// fixTrackInUpdateSets('rep$x_cita2_iq_connection');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment