SHow/ HIde List collector variable options.

ar1
Kilo Sage

Hi All,

Can anyone please help us on the below requirement.

 

We developed one catalog with few variables.

In that one variable callled Company (Select Box type) with drop down options.

ANd another variable called Region (List collector type ---> Refer to Regions table ---> Region field {List field type}).

 

And now we want to display the Region choices in slush bucket based on the Company variable selection.

 

Can anyone please help us with sample script.

Note: Gone through few link in community but no luck.

Advance thanks for the support.

1 ACCEPTED SOLUTION

ar1
Kilo Sage

Hiii,

Below script working fine for us.

Many thanks to @Ankur Bawiskar  and  @Allen Andreas .

 

Client script:

function onChange(control, oldValue, newValue, isLoading) {
var headers = g_form.getControl('u_region').parentElement.querySelectorAll('.col-xs-4');
 var collectorName = 'u_region';
var filterString = '';    
    if(newValue == 'Australia'){
        filterString = 'question.nameSTARTSWITHu_region^textNOT LIKEAustralia';
    }
    else if(newValue == 'Austria')
    {
        filterString = 'question.nameSTARTSWITHu_region^textNOT LIKEAustria';    
    }

    setCollectorFilter();
    
function setCollectorFilter()
{
//If it hasn't rendered yet, wait 100ms and try again.
if(typeof(window[collectorName + 'g_filter']) == 'undefined')
{
setTimeout(setCollectorFilter, 50);
return;
}
//Reset the filter query
window[collectorName + 'g_filter'].reset();  
window[collectorName + 'g_filter'].setQuery(filterString);  
window[collectorName + 'acRequest'](null);  
//Redisplay the list collector variable
//g_form.setDisplay(collectorName,true);
    
}

   
}

 

View solution in original post

10 REPLIES 10

Hi Ankur,

Many thanks for the response.

We changed our approach and now the list collector option displaying in down order.

But now Based on the select type variable selection need to hide the list collector variable options.

Like above scenario, when we select Australia as a option in first variable, then we need to hide/remove the Australia option from list collector variable.

Advance thanks.

Hi,

you cannot hide; you can filter the records in slush bucket as it's reference

Please use advanced ref qualifier on list collector and restrict

Regards
Ankur

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

Thanks for the response Ankur.

Could you please provide us the sample  advanced ref qualifier script to restrict for the above logic.

 

Advance thanks.

@ar

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

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

Abhay Kumar1
Giga Sage
@allen: need one more info here please, i have recently come across a strange bahavior about list collector after san-diego that calling a function of script include with passing current.variables.other_variable_value, script include get this variable value null. I hit my head but no luck can you please suggest anything in this would be great help. Thanks