Email client templates visibility for specific group

Ciobanski
Tera Expert

Hello,

I am working on some Email Client Templates for Service Operations Workspace, and I got them figured out, now I am trying to create a condition so that the templates are visible for selection in the compose section only if the user who is on the record at the moment, is part of a certain group. 

The script itself is created, however I cannot find anywhere how to call it in a template.
Tried with the filters, but not sure which field (on incident or catalog task) should I use.

Is this feasible in ServiceNow? I have searched everywhere and I do not see any condition for this. Of course, without the implementation of custom fields. 
In case it is feasible, if it can be done without scripting, I am more than thankful for such a solution.


Thank you in advance!

Kind regards,
Daniel C.

1 ACCEPTED SOLUTION

Found solution.
Indeed it was a query business rule, but with a reverse logic.
If user not part of group (Condition)
Make only other templates visible via Query function.

View solution in original post

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@Ciobanski 

email client templates can be shown/hidden based on condition.

but for your case the requirement is tricky and here is the workaround which uses scripting

Email Client Template should visible to specific role. 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello @Ankur Bawiskar 

Thank you for the response. I have checked that thread as well, however the user I want to be detected by the system is not added in any field. The script in the link mentioned uses 'current.caller', which appears to be a user referenced in the caller field and I do not have that. 

For example, let's say a service desk technician goes on an incident in SOW, they are not assigned anywhere, nor they are a caller, opened by, etc. They are only looking at that incident. They should be able to see those templates only if they are part of the service desk group. If other user that is not part of that group goes on the incident and looks there, they should not be able to see the templates.



Please let me know if that is possible.

@Ciobanski 

that's a dummy script include, let the condition be added on Number field then

Number [IS] javascript:new test().roleCheck(current)

Then add this logic in script include

roleCheck: function(current) {
		if (gs.getUser().isMemberOf('GroupSysId')) { // Please update the group sysId
			return current.number.toString();
		}
    return false;
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 

Tried it, added this in a script include then called it via the filter condition, I can still see it, with or without users in the said group via impersonation. Double checked if the sys id is correct too.