Can we write three conditions in UI action ?

String
Kilo Sage

Hi Team ,

Am using UI action to show button to incident manger and admin based on three condition 

 

1. u_error_processing== true than show button only  incident_manger

2. if u_count=4 than show only to admin

3.if u_error_processing== true and  if u_count=4 than show only to admin

 

below is my condition :

 

current.u_error_processing== true && gs.hasRole('incident_manger') && current.u_count== '4' && gs.hasRole('admin')

 

 

Screenshot 2023-02-06 at 6.13.05 PM.png

1 ACCEPTED SOLUTION

@String 

just like the normal case

new scriptIncludeName().functionName(current)

In that script include function you can add those conditions using current object and return true/false

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

9 REPLIES 9

@String 

just like the normal case

new scriptIncludeName().functionName(current)

In that script include function you can add those conditions using current object and return true/false

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 
I have a similar requirement and i am trying the way u suggested but somehow the current object fields are all coming up empty in the script include . Not sure what to do . The script in not client callable.
Any suggestions would be greatly helpful .thanks

@shubham_kumar 

script include may not be client callable that should not be an issue

pass current object in that function

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur , trying the same
new RestrictPartsActionsUtil().checkStartWorkAccess(current)==true
But all the field values of this current object are coming as undefined (even the referenced field).

Mani23
Tera Expert

Hi @String , your condition should be like below.

 

(current.u_error_processing == 'true' && gs.hasRole('incident_manager')) || (current.u_count == '4' && gs.hasRole('admin')) || (current.u_error_processing == 'true' && current.u_count == '4'  && gs.hasRole('incident_manager'))

As already suggested by Ankur, please use script include to store the condition and try to use condition by condition check if it is not working.

 

Best Regards,

Mani