Should not be able to click any UI action when field is empty

XYD23
Tera Contributor

Have a requirement that whenever field is empty I should not be able to click any UI actions available on the workspace level,

When it has some value in it then only I should be able to click

 

May I know what are the methods can we achieve this requirement?

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

@XYD23 

If UI action is being shown it doesn't make any sense not allowing user to click.

It should be this way

1) show UI action based on your condition and then user can click on it whenever they see

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Agreed with this but because of the DOM it's causing a problem on the workspace level,

Tried this client script to do it

 

Client script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

var productField = g_form.getValue('caller_id');

if (!productField) {

g_form.addErrorMessage('Please select the caller');

$$('button[data-action-name^=id_display],button[data-action-name^=resolve_incident],button[data-action-name^=tech_d]').each(function(e) {

e.hide();

});

} else {

g_form.clearMessages();

$$('button[data-action-name^=id_display],button[data-action-name^=resolve_incident],button[data-action-name^=tech_d]').each(function(e) {

e.show();

});

}

}

 

It's not working on workspace level