
- 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-26-2023 05:48 PM
Hi, from a record form (IE incident) a dictionary reference qualifier works on value change, and as indicated your scenario works without issue in a PDI - can you confirm you are using a record 'form' and not a catalog item\record producer?
I would start by getting the base ref qualifier to work, and then look at adding your 'tags' query to it, as the code you have posted looks incorrect and would result in error\unexpected results which would complicate the situation.
javascript: 'u_dependent_parent=' + current.u_owner_department.sys_id + '^sys_tags=f6c24cf787176110814c217f8bbb356a';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2023 06:26 PM
Hi Tony,
>can you confirm you are using a record 'form' and not a catalog item\record producer?
Yes, this is an incident form.
>I would start by getting the base ref qualifier to work, and then look at adding your 'tags' query to it
I removed the 'tag' query as below, but the it is still not working on field change.
javascript: 'u_dependent_parent=' + current.u_owner_department.getDisplayValue();
For example, when owner department is set as --None--, Options for Category (DX) are below.
When I select 'NYCAA' for Owner department, the options for Category (DX) does not change.
Once I save this incident form, the options for Category (DX) changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2023 07:07 PM
Hi, you stated in your first post that Owner department and Category (DX) were both reference fields for the same table (u_corporate_dx), yet the screenshot in your last post appears to show both Owner department and Category (DX) as choice lists with --None-- option enabled.
Can you clarify your configuration?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2023 07:17 PM
Hello Tony,
Yes, both Owner department and Category (DX) are reference field. Please see the screenshot below.
I selected 'Drop down with --None--' under 'Choice List Specification' tab.
- 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