Remove option from reference field variable (advanced ref qualifier)

JordyZ
Mega Sage

Hi,

I have a lookup select box (references pm_portfolio) variable called Portfolio name that has 5 options, one of them is called "Project portfolio". There is another variable called "is_the_workload_bigger_than_50_man_days", if the workload variable is No, then the Project portfolio option from the portfolio name variable should not be shown. At any other time, all 5 options should be shown.

I know removeOption/addOption doesn't work because it's a reference field. So it's going to be an advanced reference qualifier right? How do I set this up? Thanks in advance.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@JordyZ 

you can use advanced ref qualifier

Ensure you set variable attributes in the lookup select box variable

ref_qual_elements=is_the_workload_bigger_than_50_man_days

Ref qualifier:

Ensure you compare correct value for No or no

javascript: var query; if(current.variables.is_the_workload_bigger_than_50_man_days == 'No') query = 'name!=Project portfolio'; query;

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

3 REPLIES 3

ursnani
Giga Guru

Hi @JordyZ 

 

Yes, You need to use Advanced Reference Qualifier. In that You can send the Checkbox value as parameter to Script Include and by using that parameter you can filter your values

somthinglike below

 

If('your_parameter' == true){

filter with 4 option value

}

else{

filter with 5 Option Values

}

 

Please Mark my Answer as correct/Helpful if it helps you.

 

Thank you.

Ankur Bawiskar
Tera Patron
Tera Patron

@JordyZ 

you can use advanced ref qualifier

Ensure you set variable attributes in the lookup select box variable

ref_qual_elements=is_the_workload_bigger_than_50_man_days

Ref qualifier:

Ensure you compare correct value for No or no

javascript: var query; if(current.variables.is_the_workload_bigger_than_50_man_days == 'No') query = 'name!=Project portfolio'; query;

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

This did the job, thank you @Ankur Bawiskar !