Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Make template available for multiple groups

wiltonr
Giga Contributor

How can I share a template (for incident) with more than one group and not global? the current "group" field only lets us select one group. Anyone know an alternative? Or possibly a way to make the "group" field able to select multiple groups (like a Watch List looking field)?

I changed the group field type in our Dev instance from Reference to List and changed the size of the field and broke our template form.   Now I have to wait for support to fix our field type/length.   Once they fix it though, I still have the request to find a way to allow more than one group to apply a template.   In Demo, I created a List field on the sys_template table called u_groups and can add multiple groups to the field but I can't figure out how to allow the groups in that field to Apply Template - the option does not appear in the Context Menu.   How can I do this?

21 REPLIES 21

solutioningnow
Giga Guru

Hi,



You need to modify Read ACL of Template(sys_template) table to make it work.



Please mark answer as correct/helpful if it was really helpful



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


In Demo, I created a field named u_groups (list) on the sys_template form.   I created a template and added Service Desk to the u_groups field.   In the Read ACL on sys_template I changed it to this:


    var groupMatch = getMyGroups().toString().indexOf(current.u_groups) > -1;


    if (gs.hasRole("template_editor_group") && groupMatch)


          return true;


I also modified the Business Rule SNC Template Query to this:


roTemplates();


function roTemplates() {


    var answer = 'global=true^ORuser=javascript:gs.getUserID()^ORgroup=javascript:getMyGroups()^ORu_groups=javascript:getMyGroups()';


    current.addEncodedQuery(answer);


}



But Apply Template still does not show up when impersonating ITIL User (which is a member of Service Desk).


Rhonda - I think you can make a parent group with however many child groups you want, then set the template group to the parent to make it available for all of them, just did a quick test in my instance and seemed to work without issues. Would that work or do you really need to modify the system to look at a list of groups?


This is a very Elegant way to do so.