Hiding "Save as Draft" Button in Catalog Item

karolismick
Tera Contributor

Hi ServiceNow Community,

I am encountering an issue when trying to hide the "Save as Draft" button in a catalog item on the Service Portal, even after clicking Hide 'Save as draft' it is visible. Despite applying a script to hide the button, it remains visible.

Despite applying a script to hide the button, it remains visible.

Here is the script I used:

function onLoad() {
console.log("onLoad function executed");
hideSaveAsDraftButton();
}

function hideSaveAsDraftButton() {
console.log("hideSaveAsDraftButton function executed");
var saveDraftButton = document.querySelector('button.btn.btn-default.sc-btn.form-control.text-overflow-ellipsis[title="save as draft"]');
if (saveDraftButton) {
console.log("Save as Draft button found, hiding it.");
saveDraftButton.style.display = 'none';

I suspect it might be an issue with a new version of ServiceNow or perhaps I am missing something in my approach. Has anyone else faced this issue or can anyone suggest a solution to hide the "Save as Draft" button effectively?

Thank you for your help!

Regards,

Karolis

13 REPLIES 13

Out-of-the-box SP uses a widget instance of "SC Catalog Item".

Out-of-the-box EC uses a widget instance of "HRM Catalog Item".

 

Is that also your situation?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

karolismick
Tera Contributor

That is correct.

"HRM Catalog Item" This widget is in the Employee Center Core application
and

"SC Catalog Item" is the Service Portal application.




Yeah but which are you using? Or does this concern both portals?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

karolismick
Tera Contributor

Just one. sc_cat_item

Oke thats an odd answer. Did you actually check the widget instance on the portal page concerned? And which widget that is using? 

 

Share a screenshot else please.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn