Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Not equal to is not working in client script

reddy8055
Tera Contributor

Hi,

I am trying to remove choice options from variable based on grade level is not management 18 and above. I tried using the below script and it is not working. Please help! Thanks,

function updateCampus(response) {

var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
//if ((answer == 'Management 18') || (answer == 'Management 19') || (answer == 'Management 20') || (answer == 'Management 21') || (answer == 'Management 22')) {
if (answer != 'Management 18' || answer != 'Management 19' || answer != 'Management 20' || answer != 'Management 21' || answer != 'Management 22') {
g_form.removeOption('role_data_access', 'Leadership');
g_form.removeOption('role_data_access', 'Executive');
}

 

 

10 REPLIES 10

Hi,

Is there a reason you're adding the sys_id onto the encoded query line? That doesn't work.

The addQuery with the sys_id for the user can be it's own line (like you had), then the addEncodedQuery is what I mentioned above where you filter on list view as you need, then right-click the last piece of the filter breadcrumb and copy the query. I would have definitely mentioned it if you needed to add on the sys_id there 🙂

 

Please try again, you're very close!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!