want to disable the Submit button of a record producer of Scoped Application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 09:31 AM
Hello All
I want to disable the submit button of record producer with Onload script. The record producer is in a Scoped Application. I can check the id of the button by doing the Inspect element and no exists of submit button. when i am adding the javascript code i.e. document.getElementsByName('submit')[0].disabled = "true"; then it is also giving exception. Can anybody tell me where can i check the code of the SUbmit button and how can i disable the Submit button on load of the form.
Thanks in advance
Regards
Himani Goyal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 09:57 AM
Hi Himani,
what would be the use case of hiding the submit button on record producer? If you hide that submit button then how user can submit it
you can use onLoad client script as below; ensure isloate script is set to false for this onLoad client script
function onLoad(){
document.getElementById("submit_button").style.display = 'none';
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 10:23 AM
Hello Ankur
Thanks for the response. I want to hide/disable the submit button based on the condition check in the catalog client script. The Isolate script flag is set to false and i have also tried the above mentioned code in the script but the script is giving some exception so i am not able to achieve the requirement.
Can you please tell me if this is a scoped application limitation or something else as i have tried this code multiple times earlier in global application but never failed. However now i am not able to hide/disable the button.
Please help me with any other solution if exists.
Regards
Himani Goyal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 08:56 PM
Hi Himani,
what error it gives in browser console?
below code worked for me in native; set UI type as ALL and isolate script as false
function onLoad() {
//Type appropriate comment here, and begin script below
document.getElementById('submit_button').style.display = 'none';
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 09:18 PM
Using DOM manipulation is not good approach, try to avoid DOM as much as possible,
whats your use case ? why do you want to hide it ?