Remove/disable/hide record producer Submit button.

trupti3
Kilo Explorer

Hi ,

Is there any way to remove/hide or disable 'Submit ' button on a record producer using catalog client script onLoad/onChange and also preferably not doing DOM manipulation.

23 REPLIES 23

Willem
Giga Sage

Hi,

If you want to completely remove it, you can use this Knowledge Article by ServiceNow:

https://hi.service-now.com/kb_view.do?sysparm_article=KB0684408

Thank you Willem.

Even though the solution provided by you is feasible, I will not be able to use it.

The reason is I have to remove the submit button only on a particular value of a variable in catalog client script.

Is there any way to achieve this?

Hi Trupti,

 

You can use the code in the onChange catalog client script:

var varname = newValue;

if(varname=='whatever is the value'){

document.getElementById("submit_button").style.display = 'none';

}

 

Please Mark ✅ Correct and  Helpful based on the impact.

Warm Regards,

Arvind

You can try this using DOM manipulation.

  • Create an onChange catalog client script
  • Set UI Type to All or Service Portal
  • Make sure Isolate script is set to false/unchecked. This field is not on the Catalog client script by default, so you have to add this, either to the form or the list.
  • Then in the script use:
function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
       return;
    }
 
    if(newValue == 'value you want to hide the submit button for'){
        document.getElementById("submit_button").style.display = 'none';
    }
    else{
        document.getElementById("submit_button").style.display = '';
    }
    
 }

 

Or:

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
       return;
    }
 
    if(newValue == 'value you want to hide the submit button for'){
        this.document.getElementById("submit_button").style.display = 'none';
    }
    else{
        this.document.getElementById("submit_button").style.display = '';
    }
    
 }