Workspace UI Action g_modal reference field query

yashu1995
Kilo Guru

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) {

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@yashu1995 

so basically you want to show filtered data based on 1st field?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@yashu1995 

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",
Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar Thank you. Will try and update.