Hiding templates from showing?
Anyone found a way to hide templates from showing when creating a new Work item?
In my case, I am looking to hide all the built-in Change Request templates from showing, as I am creating my own templates.
I know I can delete the built-in, but is there a way to avoid it?
Best Answers
-
Joe_Burrows Cireson Devops Super IT Monkey ✭✭✭✭✭Hi Suleyman
This is possible by scoping the user role in SCSM. Example:
This can get messy to maintain across multiple roles. Just remember SCSM applies a roll up of roles, so if you have scoped one role and a user can still see the templates, its possible they have access to all templates from another role - Depending how many roles users are spread across it can sometimes be a bit of a puzzle to figure out.Cheers
Joe5 -
Joe_Burrows Cireson Devops Super IT Monkey ✭✭✭✭✭Any out of box role cannot be changed as they are sealed, you will need to create custom roles based off the base role and customize then add your users to these custom roles (And remove from out of box roles).
Hope that helps5
Answers
This is possible by scoping the user role in SCSM. Example:
This can get messy to maintain across multiple roles. Just remember SCSM applies a roll up of roles, so if you have scoped one role and a user can still see the templates, its possible they have access to all templates from another role - Depending how many roles users are spread across it can sometimes be a bit of a puzzle to figure out.Cheers
Joe
Hope that helps
var arrHideTemplates = [
//Incidents
'Generic Incident Request',
'Incident portal template',
//Service Requests
'Default Service Request',
//Problem
'CiresonDefaultProblem',
//Change Request
'Publish Offering'
]
$(function() {
var observer = new MutationObserver(function(mutations) {
$(".templatename").each(function(){
for(var i=0; i < arrHideTemplates.length; i++){
if($(this)[0].firstElementChild.outerText == arrHideTemplates[i]){
$(this).hide();
}
}
})
});
var target = document.querySelector('.drawerdetails-actions-box');
observer.observe(target, {
attributes: true
});
});
Otherwise, setting the user role to see all templates and using a script such as this one from @Jaime_Palazuelos could help your page loads and saves stay performant. It seems counter-intuitive that allowing more templates through would help performance, but in doing so you are reducing the scans that occur in the DB, and the amount of text going across the network is negligible by comparison.
Ideally, this would just work using user roles, how the product was meant to be used, rather than requiring an absurd amount of processing power to determine if a user should see a template or not, but that appears to be the state of things.
I merely wanted to point out another way that this could be helpful. For context, I have about 300 templates, and it has a noticeable performance impact. Back when we used to have significantly fewer, I did not notice any performance issues from scoping objects to user roles, either.
https://community.cireson.com/discussion/2487/ability-to-tag-templates-to-be-available-or-not-via-the-analyst-portal
For the solution above the down side with my 300 templates that would be a lot to update in the list when specifying the template name. (It does help with the OOB templates you cannot change the name)
So taking content from the other post I added the variable option from it to the above coding and it works on removing tagged templates.
This example looks for -WF in any template name to hide it. My testing shows that it appears the error presented from the other post clears in IE.
I was only able to get 1 of these scripts to work in my environment and I was having the same issue as @Nick_Flint. So, I had help from Cireson Tech Support on this but this should work in the newest Portal if you are still needing a way to hide Templates on the Portal as I did:
$.ajaxSetup({
dataFilter: function (data, type) {
if (this.url.indexOf("/GetTemplates") > -1)
{
var arrHideTemplates = [
'Default Incident Template',
'90 Day Audit Trail Review',
'Printing Issue Incident Template',
'YOUR TEMPLATE NAME HERE'
]
var serviceTemplates = JSON.parse(data);
serviceTemplates = serviceTemplates.filter(function (el) { return !(_.contains(arrHideTemplates,el.Name))});
data = JSON.stringify(serviceTemplates);
}
return data;
}
});
@john_doyle thank you for the help on this, I really appreciate it!
Would the js script above need to be placed in C:\inetpub\CiresonPortal or CustomSpace to work?