Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

can we hide custom button using onchange client script ?

String
Kilo Sage

Hi Team ,

We created a custom button in the form .

My requirement is when user changes the state field ,we are making few fields  blank and want to hide/disable the custom button .

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.setValue('date', "");
g_form.setValue('last_com', "");

 

we are making few fields blank ,but how to make custom button hide/disable ?

Please guide 

7 REPLIES 7

Hi @Samaksh Wani  tried in Scope application ,still no luck 

Hello @String 

 

  • Accessible from is set to All application scopes
  • Can read is selected
  • Allow configuration is selected

You need to check in UI Action or UI Policy that it should be accessible from all application scope.

 

 

Aman Kumar S
Kilo Patron

Hi @String ,

UI actions don't work that way, you can better add a check in the client script, so even if the user clicks on the UI action, it reads the form values and gives a user error to the user that you can't perform this action since these fields are empty or something about the state.

 

 

Best Regards
Aman Kumar