
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 05:22 PM
Hello,
I have difficulty to setup advanced qualifier, and hope someone can give me some idea.
I have two fields called ‘Owner department’ and ‘Catgory (DX)’ on incident form. Both fields are reference field, and are referencing another table (u_corporate_dx). Depends on the value selected on ‘Owner department’, I’d like to display different options for ‘Category (DX)’.
Owner department field is displaying records, which have ‘Owner department’ tag.
For Catgory (DX) field, I’d like to display the records, which the display value selected on ‘Owner department’ equals to ‘Dependent parent’ value. For example, when NYCAK is selected on ‘Owner department’, I would like to display
‘Accutal WF’, ‘BizPlan NYCAK Input Forms’, and ‘NYCAK Accounting Workflows’ for ‘Categry (DX) field. The below is Corporate DX table’s records.
I was originally thinking of using combination of simple Reference Qualifier and onChange client script (field name = owner department) below. but realized addOption does not work for reference field. And I found several community articles suggesting using Advanced Reference Qualifier. But I do not know how I can achieve this requirement using Advanced Reference Qualifier. Can someone give me some insights? Thank you.
function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } var newValue_text = ""; var gr_value_name = new GlideRecord('u_corporate_dx'); gr_value_name.addQuery('sys_id', newValue); gr_value_name.query(); while(gr_value_name.next()); { alert(gr_value_name.sys_id); alert(newValue); newValue_text = gr_value_name.u_value;
// break; }
g_form.clearOptions('u_category_dx');
var gr = new GlideRecord('u_corporate_dx'); gr.addQuery('u_dependent_parent', newValue_text); gr.query(); while(gr.next()); { g_form.addOption('u_category_dx', gr.u_value, gr.u_value); } } |
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:01 PM
Hi, I have been unable to get my PDI to shows reference fields as choice lists, even after following the SNC documentation, so cannot reproduce your issue. But I suspect this reformatting of the reference field to chocie is the reason why you are not seeing the ref qualifier function as it should. I would think the easiest option would be to use reference fields as reference fields, otherwise you might have to write client script to hide specific 'choice' values using removeOption
GlideForm | ServiceNow Developers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 09:53 AM
Tony,
I changed 'Choice List Specification' choice to '--None--', and confirmed it's working. Thank you so much for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:27 PM
Hi @Mari2 ,
Your Reference qual above is ok:
javascript: 'u_dependent_parent=' + current.u_owner_department.getDisplayValue();
You just need to add in 'Dependent Field' tab with 'u_owner_department' then it will works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 09:53 AM
Kilo, thanks for your advice!