How to remove / hide the Back Button and Attachment (paperclip) Button from the Top Bar of my Record Producer Preview Item (form)?

georgimavrodiev
Mega Guru

Hello,



My custom application has its record producer (a colleague of mine created it). It serves as a registration form for none users.
If I click on its Preview Item — the form pops up. Its Top Bar contains two buttons: Back & Attachment (paperclip) along with the title of the form: "xxx Request Form".
For references — please check the below screenshot:
CommunityForm.pngMy goal is to remove / hide the two buttons from there and leave only the title.


I reviewed all similar threads (about Attachment button, etc.) in the Community and tried all the scripts proposed there. None of them, but one worked. And it does not hide the Paperclip button, but simply disables it.

The other option which I used was to create a Variable Set and associate it to my record producer and then create an onLoad Catalog Client Script for the Variable Set with the following function:
function onLoad() {
$j('tr.sc_header').hide();
}
I saw this action in one of the threads: Re: Hide Header in Record Producer form.
As I understand — it should remove the whole header bar or in other words: not only the buttons, but also the title of the form. Yet, this also does not work…

I do not have any other ideas or approaches, but to ask for your help and expertise, SNOW fellas.
Could you please assist me with the removing of the two buttons from the Header Bar of my custom Record Producer, but leaving the title of the form?


Best Regards,
Georgi Mavrodiev

IT Consultant
Do IT Wise

You may visit us in our Web Site: www.doitwise.com

1 ACCEPTED SOLUTION

Hi Georgi,



The if condition can be written.


You have the catalog item name in the script tag. Add following



add following lines after this line of code catalogHistory.setHistory('$[HTML:sc_cat_item.name.getDisplayValue()]', catalogHistory.getPageUrl() + '$[AMP]sys_id=$[sysparm_id]');


Replace Something Broken with the name of your catalog item



if("$[HTML:sc_cat_item.name.getDisplayValue()]" == "Something Broken"){


$j("back_button_in_header").hide();


$j("sc_attachment_button").hide();


}      



So this will run only when catalog item matches your name and hide the buttons. for other it won't


i have verified and tested this.



Regards


Ankur


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

View solution in original post

21 REPLIES 21

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Georgi,



Please use the below script in your onLoad client script for the record producer



function onLoad(){


gel("back_button_in_header").style.display = "none"; // this is for the back button


gel("sc_attachment_button").style.display = "none"; // this is for the attachment icon


}



just try this and let me know.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

Hi Ankur,




Thank you for the suggestion!
Unlucky for me, the result is a negative one.



Best Regards,
Georgi Mavrodiev



IT Consultant
Do IT Wise



You can visit us in our Web Site at: www.doitwise.com


Hi Georgi,



Could you share a screenshot for inspecting the html element.


In chrome you can do Function+F12 to inspect the header element


This will help to analyse further.



Regards


Ankur


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

Hi Ankur,




Below, follows the information you requested:


safasfas111_1.png


And the header itself:
dafasfsd222.png



Best Regards,


Georgi Mavrodiev