Help with Advanced Reference Qualifier with if condition

Magali Legaspi
Tera Contributor

Hi all!!

 

I need help with this advanced ref qual.

I have this already working: javascript:if (current.variables.wbs_territory != '') "company=" + new TerritoryUserUtils().getCompany(current.variables.wbs_territory)+"^active=true";

 

What I need it to do is if current.variables.wbs_territory is "CEE Region", the only condition has to be active=true.

 

I tried writing it this way:

 

javascript:if (current.variables.wbs_territory != '') "company=" + new TerritoryUserUtils().getCompany(current.variables.wbs_territory)+"^active=true";
else(current.variables.wbs_territory == 'CEE Region') "^active=true";

 

But currently the red part's not working.

 

Any help is very much appreciated!

1 ACCEPTED SOLUTION

Grow2Dev
Tera Guru

Hello Magali Legaspi
if you first check for 'not is empty' only it will always do the instruction for the 'not is empty' condition as long as the variable is not empty. This means that even in case the value of variable is equal to 'CEE Region' it will run the Script Include that is called in the first condition for variable not is empty.
So you need to also add  at least '&& current.variables.wbs_territory != 'CEE Region'' so it will only run the Script Include of the first condition if the variable is not empty and is not 'CEE Region'.
If it is 'CEE Region' then it will run into the else statement.
Hope this helps 🙂

 

View solution in original post

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

Try it this way:

javascript:if (current.variables.wbs_territory != '') "company=" + new TerritoryUserUtils().getCompany(current.variables.wbs_territory)+"^active=true";
else if(current.variables.wbs_territory == 'CEE Region') "active=true";

Grow2Dev
Tera Guru

Hello Magali Legaspi
if you first check for 'not is empty' only it will always do the instruction for the 'not is empty' condition as long as the variable is not empty. This means that even in case the value of variable is equal to 'CEE Region' it will run the Script Include that is called in the first condition for variable not is empty.
So you need to also add  at least '&& current.variables.wbs_territory != 'CEE Region'' so it will only run the Script Include of the first condition if the variable is not empty and is not 'CEE Region'.
If it is 'CEE Region' then it will run into the else statement.
Hope this helps 🙂