Unexpected Constant condition, what is this message?

Chandler2
Tera Guru

What this means? Is it something wrong? or can be ignored?

find_real_file.png

1 ACCEPTED SOLUTION

Hi,

since this is for related list you should be using the field which refers the parent table

something like

parent.state == 9 || parent.state == 7

Regards
Ankur

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

View solution in original post

6 REPLIES 6

Anil Lande
Kilo Patron

Hi,

You should use '==' for comparison insted of '='.

The condition should be 

if(current.state==9 ||(current.state == 7)){
answer = false;
}

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Ankur Bawiskar
Tera Patron
Tera Patron

@Chandler 

the actual syntax to compare the values is with double equal to and not single equal to

== used for comparision

= used for assigning the value

So update as this

current.state == 9 || current.state == 7

Regards
Ankur

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

Harika Bhupathi
Giga Guru

Hi @Chandler ,

 

If conditions are used in the script to compare whether the values matches or not.

For comparision you need to give '=='

 

Modify your code accordingly  like below

 

if((current.state == 9) ||(current.state == 7)){

answer = false;

}

 

If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

 

Regards,

Harika

Chandler2
Tera Guru

Well, I used double == but somehow it is not working and not hiding the new option from related list.