- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 05:53 AM
How can I check if current user is same as assigned to user in business rule.
I have used gs.getUser().isMemberOf(current.assigned_to) and
(gs.getUserID() == current.assigned_to)
But both are returning false
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 06:01 AM
Greetings Sindhu21,
The 2nd one should very much work. I have a script in use right now for -
current.assigned_to == gs.getUserID();
The isMemberOf doesn't work because that checks group membership. Check your values with the script debugger by throwing in a break point.
-Andrew Barnes
Join me at Developer Blog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 05:57 AM
Hi,
You can do this in the conditions by dot-walking and the dynamic filter.
Assigned to | is (dynamic) | me
Assigned to.manager | is (dynamic) | me
Refer to To compare current logged in user and assigned to user name.
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 05:57 AM
https://community.servicenow.com/community?id=community_question&sys_id=70c8c761db5cdbc01dcaf3231f961932
Check this and you will have a solution from Chuck
Mark the anaswer as correct and helpful..!!!
Regards,
Chalan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 05:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 06:01 AM
Greetings Sindhu21,
The 2nd one should very much work. I have a script in use right now for -
current.assigned_to == gs.getUserID();
The isMemberOf doesn't work because that checks group membership. Check your values with the script debugger by throwing in a break point.
-Andrew Barnes
Join me at Developer Blog