Remove/disable/hide record producer Submit button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 03:12 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 03:21 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 03:27 AM
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?
I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 03:33 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 03:41 AM
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 = '';
}
}