Reference Field Modal on incident on SOW

Yanping Guo1
Tera Contributor

We'd like to default values on the filter for reference field "Configuration Item" model on incident form on SOW.

Example: ITIL user create an incident from SOW. They select the spyglass on "Configuration Item" field. The window pops up with filter and CI list. 

We’d like to default “Select field” to Name, and “Select operation” to “contains”.

User just need to enter CI name and click “Run”.

Is it possiable? Where can I find the code for this reference modal?

 

Thanks

 

2 REPLIES 2

vaibhav_1803
Tera Contributor

try to open the incident form in from the ServiceNow.
find the client script associated with the "Configuration Item" reference field.
and try to implement following logic
function onChange_ConfigurationItem(control, oldValue, newValue) {
// Set default filter values
g_filter.addCondition('name', 'CONTAINS', '');
g_form.clearOptions('Configuration Item'); // Clear any existing options for a fresh search
g_form.getControl('Configuration Item').setFilter(g_filter);
}

Thank you for reply. it doesn't work adding the above code to incident. It may work by adding the code to the reference field Modal.