How to add reference qualifier in catlog item

sivamanich1
Tera Contributor

I have a catlog item having  2 variables as list collectors referred to same table. One is existing accounts another one is remove account. Existing accounts is auto populate based one field change but now i want to visible only existing accounts in my remove account.

Example existing accounts I have tcs, Infosys,tech M

Only that record needs to visible in remove account as well.

4 REPLIES 4

vaishali231
Kilo Sage

Hey @sivamanich1 

You can achieve this using a Reference Qualifier on the Remove Account list collector.

Scenario:

Existing Accounts is auto-populated

Remove Account should display only the accounts selected in Existing Accounts

Example:

Existing Accounts:

TCS, Infosys, Tech M

Then Remove Account should only show:

TCS, Infosys, Tech M

Solution

Add the following Reference Qualifier on the Remove Account variable:

javascript:'sys_idIN' + current.variables.existing_accounts

Replace:

existing_accounts

with your actual variable name.

How it works:

  • List Collector stores selected record sys_ids
  • sys_idIN filters the available records
  • Only records selected in Existing Accounts will appear in Remove Account

Additional Recommendation

If Existing Accounts changes dynamically, add an onChange Catalog Client Script to refresh the slushbucket:

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading)
       return;
   g_form.setValue('remove_account', '');
   g_form.refreshSlushbucket('remove_account');
}

This ensures the Remove Account list updates immediately after changes in Existing Accounts.

*************************************************************************************************************************************

If this response helps, please mark it as Accept as Solution and Helpful.

Doing so helps others in the community and encourages me to keep contributing.

Regards

Vaishali Singh

Servicenow Developer
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb



Hey @sivamanich1 

Hope you are doing well.

Did my previous reply answer your question?

If it was helpful, please mark it as correct āœ“ and close the thread . This will help other readers find the solution more easily.

 

Thankyou & Regards

Vaishali Singh

Servicenow Developer
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb

 

Tanushree Maiti
Giga Patron

Hi @sivamanich1 

 

  1. Assumption, there are 2 list collector variables
    • existing_accounts: List Collector (e.g., Variable existing_accounts)
    • remove_account: List Collector (e.g., Variable remove_account)
  2. Configure "Remove Account" Variable:
  • Go to the "Remove Account" variable definition.
  • Under Type Specifications, set Use reference qualifier to Advanced.
  • In the Reference qual field, enter:
    javascript:'sys_idIN' + current.variables.existing_accounts

 

  1. Create Catalog Client Script:
    • Name: Filter Remove Account List
    • Type: onChange
    • Variable Name: existing_accounts

function onChange(control, oldValue, newValue, isLoading) {

    if (isLoading) {

        return;

    }

   if (newValue === '') {

        g_form.setValue('remove_account', '');

        return;

    }

 

    g_form.refreshSlushbucket('remove_account');

 

}

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ankur Bawiskar
Tera Patron

@sivamanich1 

so please share screenshots and what you tried

without this we can't help

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