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

BhupeshG
Tera Guru

did anyone find any solution to this requirement

Hi BhupeshG,

Showing the template to multiple users on the list can be done by Read ACL and it will be table Level so select None in the dropdown.

And can be achieved using the below code:-

var checkStr = "", arrayUtil = new ArrayUtil(), check = "", groupsSysIDArr = current.u_groups.split(','), groupNameStr = "";
for (var j = 0; j < groupsSysIDArr.length; j++) {
var gr = new GlideRecord("sys_user_group");
gr.addQuery('sys_id', groupsSysIDArr[j]);
gr.query();
if (gr.next()) {
groupNameStr += gr.name + ",";
}
}
var groupNameArr = groupNameStr.split(',');
for (var i = 0; i < groupNameArr.length; i++) {
check = gs.getUser().isMemberOf(groupNameArr[i]);
checkStr += check + ",";
}
var CheckArr = checkStr.split(',');
if (arrayUtil.contains(CheckArr, 'true')) {
answer = true;
} else {
answer = false;
}

 

This is help you in showing the Template to multiple Groups through List View. But showing it on the form can only be achieved by making some changes in the UI Macro (template_context), which I am also not able to achieve.

 

If you have implemented that, please help me with the same.