- 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-08-2025 07:43 PM
I have already wrote that code even though it was not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2025 04:25 PM
It looks like you are not in Global scope. Please add toString() as:
current.state == "1" && gs.getUser().isMemberOf(current.assignment_group.toString())
I have just tried the same on a scoped app and it is returning true/false as expected.
If it is not working, could you please share if any error thrown in the logs as well as a screenshot from your UI Action.
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2025 08:36 PM
These was the code which I wrote first , it was not working so I have used another code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2025 05:31 PM
Check first whether the user is part of that assignment group or Not ?
Regards
Ch Hemant Kumar
Lead-Ciena
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2025 08:29 PM
are you sure you are comparing correct state value?
Did you try to debug 1 by 1 by removing the condition and see which one is failing?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader