- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 09:17 AM
Dear team,
Iam new to serviceNow, i have an issue that my button is not visible even wheb the condition was true!
my condition is: current.state === 1 && gs.getUserID().isMemberOf(current.assignment_group)
explanation: the button must be visible when the state was new and the loggedin user was a member of the current assignment group.the button was not visible evn when condition become true.i impersonate myself as an member of the assignment grp and state was new but the prblm ws button wasnt visible.
preview: i have checked form button
i have checked everything from reading other article evnthough itwasnot working
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2025 09:03 PM
Hi @Fahimas ,
The type of current.state will return an object and when you compare an object with number it will return you false, since you are using AND operator when the initial condition is false it will not test the other conditions. You can use == to compare state value.
And instead of getUserID use getUser(). getUser() return entire user object where as getUserID() return only the sys_id of the particular user.
current.state == 1 && gs.getUser().isMemberOf(current.assignment_group)
Mark this helpful/ Accept the solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 10:12 PM
no it was not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 10:20 PM
I also written some code for on hold button which also not working
code: current.state===3&&(gs.getUser()===current.assignment_group||current.assigned_to)
Let me know what was wrong with these also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2025 11:01 AM
Hello @Fahimas
Please use gs.getUserID() == current.assigned_to
And by the condition current.assignment_group - what did you want to achieve by this ?
Also for you check all the steps that I mentioned above ?
Regards,
Shivalika
LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
YouTube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=8vHknTGfxDTNkcx9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2025 07:45 PM
My condition was when the state was on onhold and the loggedin user was in the assignment group field and assigned to field but my code was not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2025 12:23 PM
Hi @Fahimas,
Could you please use?
current.state == "1" && gs.getUser().isMemberOf(current.assignment_group)
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.