Disable/Hide 'Save' & 'Submit' button for custom application

Hussain Kachwal
Mega Guru

Hello All,

I am trying to hide 'Save' & 'Submit' button for a custom application by using below client script (onLoad) , but doesn't seem to be working. Can anybody direct me to my mistake?

function onLoad() {

    var items = $$('BUTTON').each(function(item){

    if(item.innerHTML.indexOf('Submit') > -1){

          item.hide();

    }

});

}

I even tried to create an UI action with same action name (OOTB-Save & Submit) as that of what I want to hide and added a false condition to that new UI action, without luck.

Also, attempted to Exclude the visibility of Save UI Action for my custom application on sys_ui_action_view.

Any update will be welcomed.

1 ACCEPTED SOLUTION

Tushar Sharma2
Kilo Guru

Hello Hussain,



Create a new record on sys_ui_action_view table with below field value.



UI Action Visiblity- select the UI Action which you want to hide. In your case select 'Save' or 'Submit' UI Action created on global application.


View   - Select the view of the form on which you want to hide the UI Action.


Application Global


Visibility : select Exclude from the Menu



Above entry will be populated in 'UI Action Visibility' related list of your UI Action.



Hit Like or Correct on the impact of response.



-Tushar


View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Hussain,



if you are using scoped app then this won't work since it doesn't allow DOM manipulation inside scripts.



Also can you check whether it is going inside the if condition by adding alert statement.



Regards


Ankur


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

SNOW User8
Giga Guru

Hi Hussain Kachwala



Check this one


function onLoad() {


$('BUTTON ACTION NAME').show();


}


Tushar Sharma2
Kilo Guru

Hello Hussain,



Create a new record on sys_ui_action_view table with below field value.



UI Action Visiblity- select the UI Action which you want to hide. In your case select 'Save' or 'Submit' UI Action created on global application.


View   - Select the view of the form on which you want to hide the UI Action.


Application Global


Visibility : select Exclude from the Menu



Above entry will be populated in 'UI Action Visibility' related list of your UI Action.



Hit Like or Correct on the impact of response.



-Tushar


can we disable the submit button if the mandatory fields are not filled...if we fill the mandatory fields the submit button has to show ...we to do this by using client scripts how can we do this