- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 02:25 AM
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:My 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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 10:41 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 04:05 AM
Hi Georgi,
Do you want to hide the header itself or the 2 icons i.e. back button and paperclip icon
Following is the screenshot in my instance when you expand the <div> tag with id as back_cell.
1) id = "back_button_in_header" for back icon
2) id = "sc_attachment_button" for paperclip icon
you try to find the similar in your instance and replace the id appropriately. I think it should be same across all instances.
I wrote an onLoad script and it is working in my demo instance. Screenshot attached
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 04:46 AM
Hi Ankur,
I have just completed the check and the answer is Yes - the IDs are similar across all instances.
Well, then why the script does not work for me... mb I am doing something wrong.
Ankur, will it be comfortable for you to provide me with steps - starting from the SNOW Navigator for the way and the actions you used to creating the script.
Please be as detailed as possible, mb I am skipping something during the script creation.
I would like to make a note here: I am not sure how this record producer was made, as I did not create it.
I only know that it was created for a custom application and it was created via the iFrame of Content Management, and I think the Header which I want to modify, actually calls for or comes from a default content type... I hope the test case is the same at your DEV instance.
Best Regards,
Georgi Mavrodiev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 04:57 AM
Hi Georgi,
Here are the steps:
1) In left nav go to catalog client scripts and create new
2) Give some name and select type as onLoad
3) Select Applies to as "Catalog Item" and Catalog Item as the one for which you want to hide these icons
4) add following code inside the onLoad method
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
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 05:15 AM
Hi again, Ankur,
Thank you for taking from your time to write down the steps used!
Now, I can confirm that I am not missing anything. I do the same steps during the creation of my Catalog Client Script.
So, the solution does not work for me. I am not sure why.
To confirm that the problem is not in "My TV" only, I tested the same record producer in another DEV instance.
The solution did not work also for it.
Now, I am starting to think that mb the URL of my record producer iFrame is making the whole problem.
I will now dig into it by reading information in this direction. Hopefully something will pop - up.
Best Regards,
Georgi Mavrodiev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 10:30 AM
Hi Ankur,
After continuing to dig into the URL (Content Management > IFrames -> the iFrame of my custom application -> URL field) I found out that its element "com.glideappr.servicecatalog_cat_item_view" is actually the name of a Global UI Page, called: "com.glideapp.servicecatalog_cat_item_view".
It is responsible for my record producer's form (preview output). So, I decided to use the following two lines of code and add them into the script of the UI Page:
After making these changes - I may say that I have achieved my goal:
As you may see, the Back and Attachment (paperclip) buttons are no longer presented into the header of my record producer
Yet, I have to say that by modifying the script of the UI Page - I have actually made a change which will impact all record producers and forms that use this specific UI Page. So, this approach of mine is not so good. In order to improve it, I am thinking of creating an if condition against the custom table of my record producer's form and put the above two lines of code into it, so the UI Page can hide the two buttons only in regards to the custom app of mine.
Here, I will appreciate if you could help me making this if condition or what ever change of the code, you believe will do the trick, as I am not familiar with the script in which the UI Page is written. I believe this is a jelly script and as I know the jelly if conditions are different than the JS if conditions.
So, could you please give me a hand?
Best Regards,
Georgi Mavrodiev
IT Consultant
Do IT Wise
You may visit us in our Web Site: www.doitwise.com