How to set UI Action Condition. To visible based on true/false condition

suresh40
Tera Contributor

Hi All,

my requirement is to hide UI action button based true/ false field . Please help me on this . 

I have written UI Action condition but its not working .

 

Thanks,

Suresh.

1 ACCEPTED SOLUTION

Abhijit4
Mega Sage

Do you want to show if all of condition meets then try below code,

current.state==-5 && !current.isNewRecord() && current.u_wood_mill!=true

OR 

current.state==-5 && !current.isNewRecord() && current.u_wood_mill!='true'

Let me know if you have any further questions. 
 
Please mark this as Correct or Helpful based on the impact.

Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

View solution in original post

2 REPLIES 2

Jan Janou_ek
Tera Expert

Hello suresh,

I use an UI policy for this, u need to uncheck "Isolate script" and set your conditions. To script put this:

execute if true:

function onCondition(){
$$('#ui_action_name')[0].show();
}

execute if false:

function onCondition() {
$$('#sui_action_name')[0].hide();
}

Works in Rome and San Diego.

Abhijit4
Mega Sage

Do you want to show if all of condition meets then try below code,

current.state==-5 && !current.isNewRecord() && current.u_wood_mill!=true

OR 

current.state==-5 && !current.isNewRecord() && current.u_wood_mill!='true'

Let me know if you have any further questions. 
 
Please mark this as Correct or Helpful based on the impact.

Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP