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.

1 REPLY 1

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