Enable/Disable UI action buttons from client script

G Balaji
Kilo Guru

Hi,

We've UI action button that is calling script includes. 

Challenge is this UI action button has to be enabled/disabled based on if a field has value or not. How to accomplish this?

Thanks.

4 REPLIES 4

Marco Nappo_
Mega Guru

In any UI Action there is a Condition field, you can set your condition depends on a field value such as: current.field_name == value so it will be visible only if condition is true.

If you want to check if that field has a value or not you could simply use the not symbol (!), as :!current.field_name

p.s. minor edit. For checking field to be empty, had to use:

!current.field_name.nil()

Alikutty A
Tera Sage

Hi,


The condition of field should be updated to hide/display UI actions on the form.

current.some_field == 'some_value'

This would execute on the server side, so your form should be saved for it to work.

 

Thanks!

 

 

Prakhar7
ServiceNow Employee
ServiceNow Employee

Is there a way to achieve this on client side?

If I don't want to save the form and just enable/disable a button based on an entry in the form currently, will it be possible to do this?