Hide Hardware Asset tasks
Dear all,
after updating cireson to 9.4.5 we aren't able anymore to hide the Hardware Asset tasks by using:
$(document).ready(function () {
if (window.location.href.indexOf("AssetManagement/HardwareAsset/Edit") === -1)
{return;}
var mainPageNode = document.getElementById('main_wrapper');
var observer = new MutationObserver(function(mutations) {
//The page changed.
var titleElement = $(".page_title");
// check page title actually exists
if (titleElement.length > 0) {
//var csli = $("li:contains('Change Status')");
//$(csli).hide();
$( ".taskmenu li:contains('Associate Cost Center')" ).hide();
$( ".taskmenu li:contains('Associate Custodian')" ).hide();
//done with observer
observer.disconnect();
}
});
var observerConfig = { attributes: true, childList: true, subtree: true, characterData: true };
observer.observe(mainPageNode, observerConfig);
});
Does anybody have a working solution?
PS: The following solution is just working for work items :(
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
formObj.boundReady(function(){
var vm = pageForm.viewModel;
$( ".taskmenu li:contains('Remove Me From WatchList')" ).hide();
$( ".taskmenu li:contains('Add Me To WatchList')" ).hide();
});
return;
});
Thanks in advance!
Best regards
Best Answer
-
Justin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭
@Peter_Muttenthaler - You can try this instead:
app.custom.formTasks.add('HardwareAsset', null, function (formObj, viewModel) {
$(document).on('ajaxStop', function() {
$( ".taskmenu li:contains('Associate Cost Center')" ).hide();
$( ".taskmenu li:contains('Associate Custodian')" ).hide();
})
});
5
Answers
@Peter_Muttenthaler - You can try this instead:
app.custom.formTasks.add('HardwareAsset', null, function (formObj, viewModel) {
$(document).on('ajaxStop', function() {
$( ".taskmenu li:contains('Associate Cost Center')" ).hide();
$( ".taskmenu li:contains('Associate Custodian')" ).hide();
})
});
Hi Steve,
thank you for your fast and great reply! It did it for me ;)