Reference Qualifier for Change Request form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2025 12:38 PM
Hello folks!
I need help with a Dynamic Ref Qual field.
From the change_request table form:
1. My configuration item field (cmd_ci), needs to show the CIs related to the company previously selected,
1.1 This field is from the Task table
1.2 Field type "choice"
2. My Services field, needs to show the Terms and Conditions available for the company selected
2.1 Reference: clm_m2m_contract_and_terms
2.2 Field type: Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 12:54 AM - edited 08-22-2025 12:59 AM
Hi @HansellF ,
- Give it a descriptive name (e.g., "ChangeRequestRefQualifiers").
- Ensure the "Client callable" checkbox is checked.
- Inside the script, you'll define functions to handle the logic for each dynamic reference qualifier.
- Navigate to the Change Request form and right-click on the "Configuration Item" field.
- Select "Configure Dictionary".
- Important: The Configuration Item field is likely defined on the Task table, which Change Request extends from. Instead of modifying the base dictionary entry, create a Dictionary Override for the Change Request table.
- On the Dictionary Override, go to the "Reference Qual" field.
- Enter a JavaScript call to your Script Include function, passing in the relevant field (the company field on your Change Request form) as a parameter.
- In your Script Include (ChangeRequestRefQualifiers), define a function like this:
var ChangeRequestRefQualifiers = Class.create(); ChangeRequestRefQualifiers.prototype = { initialize: function() {}, getCompanyCIs: function(companySysId) { var ciList = []; var gr = new GlideRecord('cmdb_ci'); gr.addQuery('company', companySysId); gr.query(); while (gr.next()) { ciList.push(gr.getUniqueValue()); } return 'sys_idIN' + ciList.join(','); }, type: 'ChangeRequestRefQualifiers'};
- Right-click on the "Services" field and select "Configure Dictionary".
- On the "Reference Specifications" tab, choose "Advanced" for the "Use Reference Qualifier" field.
- In the "Reference qual" field, call a function in your Script Include, passing in the company field from the Change Request form.
javascript: new ChangeRequestRefQualifiers().getCompanyTerms(current.company);
- Add the following function to your Script Include (ChangeRequestRefQualifiers):
getCompanyTerms: function(companySysId) { var termsList = []; var gr = new GlideRecord('clm_m2m_contract_and_terms'); // Table for Terms and Conditions gr.addQuery('company', companySysId); // Assuming a 'company' field on this table gr.query(); while (gr.next()) { termsList.push(gr.getUniqueValue()); } return 'sys_idIN' + termsList.join(','); },
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks, GP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 01:09 AM
1. My configuration item field (cmd_ci), needs to show the CIs related to the company previously selected,
-> the CI field is at task level, so you should create a dictionary override for Change Request table and then add your ref qualifier there
-> But based on company previously selected -> which field is this?
2. My Services field, needs to show the Terms and Conditions available for the company selected
2.1 Reference: clm_m2m_contract_and_terms
2.2 Field type: Reference
-> what did you start with and where are you stuck
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2025 03:54 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader