How the list Collector field dependent on another list collector field in catalog

varshajain
Tera Expert

I have one list collector field country which takes reference from core company table
and other list collector field Company Code which takes reference from custom table and in this custom table one field country which takes reference from same core company table.

Now I want whatever multiple value I selected in country, its dependent code should only visible in company code field. 

I tried with client script and reference qualifier but it doesn't work.

3 ACCEPTED SOLUTIONS

@varshajain 

u_country_reports -> reference to core_country table?

Share dictionary config screenshot for this

variable "for_which_countries_do_you_want_the_" refers to core_country table?

share variable config screenshot for this

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

@varshajain 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

@Ankur Bawiskar 
Thank you so much for your response. It works from your method by only reference qualifier and script include is not required.

View solution in original post

20 REPLIES 20

Hi @Utpal Dutta 
At Here in 

grComCode.addQuery('u_company_code', 'IN', company)

u_company_code should be replaced by company or code from custom table ?

 

 

Hi @varshajain ,

It should be the field where it is referring to core company table.

 

Thanks

Hi @Utpal Dutta 
I tried with your method but didn't work , Please provide the solution for it why it's not working.

 

I tried with this 

var setCompanyCode_3 = Class.create();
setCompanyCode_3.prototype = {
    initialize: function() {
    },

    getSysIdsFromDisplayValues: function(displayValues) {
        var sysIds = [];

        gs.log("Received displayValues: " + displayValues);

        if (displayValues) {
            var names = displayValues.split(',');

            gs.log("Split names array: " + names.join(','));

            var gr = new GlideRecord('u_hr_requestmanagement_option'); // Replace with your country table
            gr.addQuery('u_country_reports.sys_id','IN',names); // Replace 'name' with your display field
            gr.query();
            while (gr.next()) {
                sysIds.push(gr.getUniqueValue());
                gs.log("Found matching record with sys_id: " + sysId);
            }
           
        }
        return sysIds.join(',');
       
    },

    type: 'setCompanyCode_3'
};

Ankur Bawiskar
Tera Patron
Tera Patron

@varshajain 

no script include required.

Add this in reference qualifier of 2nd list collector

javascript: 'u_country_reportsIN' + current.variables.for_which_countries_do_you_want_the_report_for;

In variable attributes of 2nd list collector add this

ref_qual_elements=for_which_countries_do_you_want_the_report_for

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar It doesn't work in my client instance. Can you help me in any other solution.?