Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action Condition not working

maheshchaudhary
Kilo Expert

I have created one link on Story form using UI Action but i want that link to be visible when it matches below conditions :-

1) Story state should not be "Complete" or "Cancelled".

2) the assignee (the person to whom the story is assigned) should be a member of one group i.e.   "Network Team".

but this condition "current.assigned_to.isMemberOf("Network Team") == true" is not working , why

current.state != 3 && current.state != 4 && gs.hasRole("itil") && current.assigned_to.isMemberOf("Network Team") == true

        find_real_file.png

1 ACCEPTED SOLUTION

DIsagree, saying 'state is not 3 and state is not 4' will work just fine.



the use of isMemberOf() is the problem here, it's a GlideUser method so you can't use it on the current object.


View solution in original post

8 REPLIES 8

Jaspal Singh
Mega Patron
Mega Patron

Hi Mahesh,



Kindly replace



current.assigned_to.isMemberOf("Network Team") == true



with



current.assigned_to.isMemberOf("Network Team")


i did the same. it is still not working.


Then in your case I guess you want to make button visible only when user is part of Network Group & is logged in.



so you can use below



(current.state != 3 || current.state != 4) && (gs.getUser().isMemberOf('Network Goup'))


or


(current.state != 3 || current.state != 4) && (gs.getUser().isMemberOf('Network Goup'))


mig
Mega Guru

I would put the states in an OR condition:


(current.state != 3 || current.state != 4) &&   .....