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

Mike_R
Kilo Patron
Kilo Patron

You might want to use an OR condition instead for the roles. Something like this 

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

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@String 

why not?

If the UI action condition becomes longer I would recommend to use script include function and invoke it from UI action condition

Did you debug step by step where it's failing?

 

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

Hi @Ankur Bawiskar  thanks for your reply ,can you please share sample code like invoke script include function from UI action .it will be helpfull 

The way you'd call a server callable Script Include (aka not ajax).   new ScriptIncludeName().FunctionWithinSi(current)      and have it return true/false.