How to compare current user with assigned to field in service now

Community Alums
Not applicable

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

 

1 ACCEPTED SOLUTION

Andrew Barnes -
ServiceNow Employee
ServiceNow Employee

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

View solution in original post

5 REPLIES 5

But if I have 2 diferent people on the assigned_to the compare runs false
Is there any workaround for that
My case I have a List type field that references sys_user
when I have
find_real_file.png
1 person assigned
it works properly

but when is more than one
find_real_file.png
does not work