How to hide attachment icon of catalog item in service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 06:00 AM
I want to hide attachment icon for specific catalog item in "Service Portal" view.
Note: I am able to hide on normal catalog item view but not in "Service Portal" The code which i have written is working on catalog item view but its not
working on "Service Portal" view even i have used "UI Type = Bothe" in client script.
Please suggest.
Regards,
Sumit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 07:54 AM
Hi Sumit,
This DOM won't work in Service Portal.
Also are you using scoped app for this?
If yes then have a replica of this script in Global scope and deactivate the current one and test it once.
In global scope you can use dom manipulation in client script.
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
‎09-25-2017 08:23 AM
I am not using scoped application for catalog item. Client script is in global application only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 09:20 AM
Hi Sumit,
It worked for me the same code. Can you check in browser console log.
screenshot below:
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
‎09-25-2017 09:06 PM
The way which you tried is not from service portal. Its normal catalog item view. My script is working in this view but not in service portal view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 12:18 AM
Hi Sumit,
I was able to find a solution/work-around if you can add a variable to the specific catalog item you don't want the attachment icon to show up.
1. Create a new variable of type 'macro' to your specific catalog item.
2. Create a new service portal widget, below is the script you need in your Client Controller. You can leave the HTML and Server side scripts as empty/default.
function() {
/* widget controller */
var c = this;
angular.element('label.ng-scope').hide();
//NOTE : The above line here is a JQuery selector inside the angular.element() which is supported in service portal, feel free to change this JQuery selector if you want the attachment element selection to be more specific, for now I am using element label and the class combination to hide the attachment
}
3. Now select the widget created in step 2 as the widget to your variable (shown below).
4. Navigate to your catalog item in your portal and now you should not be seeing the attachment icon and related text.
Hope this helps.