Workspace UI Action g_modal reference field query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 01:54 AM
Hi All,
Have a 2 fields to show on the Agent workspace on click of UI action Closed Complete.
1. HR Service
2. HR Subcategory
In HR Sub category only choices related to selected HR service in option 1 should be available.
Kindly help me on how to achieve this on how to pass HR Service Selected value to Subcategory.
@Ankur Bawiskar last time you helped me with work around to use two modals. Kindly help me on this
Below is the Script using
var showServiceCorrectionFields = [{
type: 'reference',
name: 'u_select_correct_hr_service',
label: getMessage('Select Correct HR Service'),
mandatory: true,
reference: 'sn_hr_core_service',
referringTable: 'sn_hr_core_case',
referringRecordId: g_form.getUniqueValue(),
value: g_form.getValue('u_select_correct_hr_service'),
displayValue: g_form.getDisplayValue('u_select_correct_hr_service')
}];
var showSubcategoryCorrectionFields = [{
type: 'reference',
name: 'u_select_correct_sub_category',
label: getMessage('Select Correct HR Service Sub Category'),
mandatory: true,
reference: 'sn_hr_core_hr_service_subcategory',
referringTable: 'sn_hr_core_case',
referringRecordId: g_form.getUniqueValue(),
value: g_form.getValue('u_select_correct_sub_category'),
displayValue: g_form.getDisplayValue('u_select_correct_sub_category')
}];
Using Two Modals as workaround to achieve the result:
g_modal.showFields({
title: getMessage('Close Complete'),
fields: showServiceCorrectionFields,
instruction: getMessage('Provide a correct HR Service'),
size: 'lg'
}).then(function(newServiceFields) {
if (newServiceFields.updatedFields[0].value != 'd9a940701bcd3d90ec5810a1b24bcbcd') {
g_modal.showFields({
title: getMessage('Close Complete'),
fields: showSubcategoryCorrectionFields,
instruction: getMessage('Provide a correct HR Service Subcategory'),
size: 'lg'
}).then(function(newSubcategoryFields) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 02:21 AM
so basically you want to show filtered data based on 1st field?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 02:35 AM
@Ankur Bawiskar Yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 02:51 AM
I doubt it will work.
Somehow if you get the value of 1st reference field then you can use this apply filter to 2nd one
"query" : "type=itil",
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 03:04 AM
@Ankur Bawiskar Thank you. Will try and update.