- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2021 08:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2021 09:04 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2021 08:51 PM
Hi,
You should use '==' for comparison insted of '='.
The condition should be
if(current.state==9 ||(current.state == 7)){
answer = false;
}
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2021 08:53 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2021 08:54 PM
Hi
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2021 08:57 PM
Well, I used double == but somehow it is not working and not hiding the new option from related list.