Service Desk 7.3 and above
Requires Access To:
In this article, we are going to describe how to show or hide actions for a specific role without modifying the privileges. Indeed, sometimes it is required to hide an action at a specific status only (like Add Notes) and we are going to apply this example on an incident process.
Step by Step:
In this example, let's work on a simple process which contains two statuses "Open" and "Closed", and an action "Add Notes" that we want to be visible only by users having the administrator role. Add a precondition before this action "Add Notes" and call is "Is Admin" for instance as on the screenshot below:
Set up this precondition as the following: Condition Type = Calculation, Condition = Equal, Value = true. Then use the following calculation and adapt it to the context of your environment:
import System static def GetAttributeValue(Incident): Value = false Username = Incident.GetCurrentUserName().ToLower() User = Incident.GetObjectByAttribute("System.User", "Name", Username) for item in User.UserRoles: if item.Role.Name == 'Administrators': Value = true return Value
As mentioned above, this is a specific example and you must replace 'Administrators' by the name of another role ('Analyst' for instance). Use the name which is unique, not the title !
This calculation is called from an Incident process but can of course be applied to any other process
You can of course adapt this calculation to Groups instead of Roles
We created two users for this example, one Analyst and one Administrator. We expect then the administrator to see this "Add Note" action while the analyst doesn't.