How to limit the tables displayed in table selector of a 'Document ID' field?

sambhogal
Kilo Contributor

Hi Folks,

We are trying to implement some functionality in which we require a Document iD field and we need to be able to do the things below:

Preference 1: Be able to limit/default the value of the 'Table name' field (Document ID field type)based on another field on the same table (named 'Type')

Preference 2: Be able to limit a predefined set of tables which appear in the 'Table name' field of the Document ID type field instead of showing all the tables

Any ideas/solution are appreciated! Thank you!!

5 REPLIES 5

It also works in a custom scope and in a Script Include that is used for other things and has more functions. Nice solution!

Example:

var CustomTemplateUtil = Class.create();
CustomTemplateUtil.prototype = {

	getAvailableTemplates: function(tableName, recordSysId) {
		// ...
	},
	
	applyTemplate: function(recordSysId, templateSysId) {
		// ...
	},

	/**
	 * Returns the table names available for the table selection field on the form.
	 * ! Attention: Do not change this function name. It is used by the internal ServiceNow logic.
	 */
	process: function() {
		var tableNames = ['x_custom_request', 'x_custom_task', 'x_custom_project'];
		return tableNames;
	},

    type: 'CustomTemplateUtil'
};

 

PaulKunze_0-1747832692077.png