Removing Favourites Button - Service Catalog
Dear All,
I would like to remove the favorites button from the service catalog. I have the following code and it works for none advanced request offering items. Can someone help with some code which can remove the button from standard and advanced request offering types?
Thanks
Daniel
// Removing favorite button from SC
$(document).ready(function () {
setTimeout(function() {
var url = window.location.href;
if (url.indexOf("ServiceCatalog/RequestOffering") > 0 ) {
$('button:contains("Favorite")').hide();
}
}, 500);
});
Best Answer
-
Mikkel_Madsen Customer Advanced IT Monkey ✭✭✭
This should work
$(document).ready(function() { var url = window.location.href; if (url.indexOf("ServiceCatalog/RequestOffering") > 0 ) { var mainPageNode = document.getElementById('main_wrapper'); var observer = new MutationObserver(function(mutations) { if ($('#drawer-taskbar .fa.fa-star-o').length > 0) { observer.disconnect(); $('#drawer-taskbar .fa.fa-star-o').parent().css("display", "none"); } else { return; } }); var observerConfig = { attributes: true, childList: true, subtree: true, characterData: true }; observer.observe(mainPageNode, observerConfig); } });
5
Answers
@CaterhamITSupport can you provide a full screen shot of what you are trying to achieve? I'm not sure I fully understand it 😊
Here is the picture. I would like to remove the favorite button from advanced request offering along the bottom of a RO.
This should work
Hi Mikkel,
Thanks for the help but this didn't work.
Kind Regards
Daniel
It does work, have you checked that it is loaded? F12 - Console
Maybe a cache issue
Does this replace my current code?
Thanks
Daniel
It hides the favorite "button" on taskbar drawer when you have a advanced request offering.
I have no "standard" request offering so i haven't testet that one.
It does work, sorry I didn't close my browser.
Really appreciate the help with this.
Kind Regards
Daniel