Set the Reporter's Manager as Approver from Okta
The need
Some organizations manage their users outside of Jira, typically in user directories such as Okta, Azure AD, Google Workspace, etc. These user directories are used to manage user records which hold useful information, including:
First name and last name
Job title
E-mail address
Phone number
Staff ID
Organization
Department
Manager
Those organizations use Jira as the main tool for their business processes and operations. In order for those processes and operations to be efficient and effective, users need to be tightly integrated.
A common use case for many Jira Service Management customers is to route approvals to a requestor's manager.
Solution
Elements Connect and Jira Automation can help automate this, as long as the manager's e-mail is stored as a profile attribute in Okta.
Use the power of Elements Connect to fetch the reporter's manager email combined with the strength of Automation to use that information to set the approver of a request.
How to configure a read-only Connected item displaying the reporter's manager’s e-mail
Prerequisites
Have Jira Service Management
Have an external user directory (in this example, we use Okta) or an external datasource that holds user records
Have Elements Connect installed on your instance
Configuration steps
(Optional) Configure a custom attribute “Manager e-mail” for your users in Okta
Configure the connection between Elements Connect and Okta
Configure the read-only Connected item that fetches the reporter’s manager’s e-mail
Add the read-only Connected item to the Service Management project
Configure an Automation rule to set the Approver on created issues in Automation
Steps
1. Configure a custom attribute “Manager e-mail” for your users in Okta (Optional)
You can skip this step if the manager email attribute is already configured on user profiles of your Okta account.
Okta allows you to add custom attributes to Okta user profiles to define additional attributes that are not available in the base attributes. In this use case, we need to be able to fetch a reporter’s manager e-mail attribute so we will add it to Okta.
From Okta’s Profile Editor, a custom attribute named “Manager Email” was added to user profiles:
You can refer to this article in order to add a custom attribute to Okta user profiles.
2. Configure the connection between Elements Connect and Okta
We are back in Jira. The first step is to configure the connection to the datasource where your user records are held. In this example, an Okta account is used. This connection is done in Elements Connect.
Go to Elements Connect administration by clicking on “Apps”, then Elements Connect
Now you need to create a datasource for the Okta account.
Refer to this step-by-step tutorial to configure a datasource to Okta.
After following this tutorial, your Okta datasource should be up and running.
3. Configure a read-only Connected item that fetches the reporter’s manager’s e-mail
The next step is to configure a read-only Connected item that fetches the reporter’s manager’s e-mail from the Okta datasource.
REST endpoint:
users/?search=profile.email eq "$reporter.emailAddress"
This endpoint returns the following JSON:
JSON response
[
{
"id": "00u6jacxfa7dD9Y4I5d7",
"status": "RECOVERY",
"created": "2022-09-16T12:42:43.000Z",
"activated": null,
"statusChanged": "2022-09-16T13:31:17.000Z",
"lastLogin": "2022-10-04T14:09:28.000Z",
"lastUpdated": "2022-09-29T07:21:07.000Z",
"passwordChanged": "2022-09-16T13:31:20.000Z",
"type": {
"id": "oty6jacxagCnIUGUm5d7"
},
"profile": {
"lastName": "Lallement",
"zipCode": "31000",
"manager": "Christophe Promé",
"city": "Toulouse",
"displayName": "Juliette Lallement",
"secondEmail": null,
"title": "Product Manager",
"login": "juliette.lallement@elements-apps.com",
"employeeNumber": "EL850392",
"firstName": "Juliette",
"primaryPhone": "+33xxxxxxx",
"mobilePhone": "+33xxxxxxx",
"streetAddress": "2 Esplanade Compans Caffarelli",
"organization": "Elements Apps",
"department": "Product Management",
"manager_email": "christophe.prome@elements-apps.com",
"email": "juliette.lallement@elements-apps.com"
},
"credentials": {
"password": {},
"emails": [
{
"value": "juliette.lallement@elements-apps.com",
"status": "VERIFIED",
"type": "PRIMARY"
}
],
"provider": {
"type": "OKTA",
"name": "OKTA"
}
},
"_links": {
"self": {
"href": "https://dev-98306904.okta.com/api/v1/users/00u6jacxfa7dD9Y4I5d7"
}
}
}
]
In order to get the e-mail address of the reporter’s manager, the following template is configured:
Template:
${(data[0].profile.manager_email)!}
Refer to this page Writing templates with Apache FreeMarker for details about template configuration.
4. Add the read-only Connected item to the Service Management project
Now that your connected item is configured properly, you can associate it to a request type in your Jira Service Management project.
Go to your Jira Service Management project administration, and find the “Connected items” section.
Add the Connected item to the desired request type (for example: Request a new account)
Click the “Hide option”
Open the request type in the customer portal (you can use the button in the top right of your screen)
As expected, the read-only Connected item previously configured is not visible from the request form. However, from the Support Agent view, the read-only Connected item is well visible and set to the reporter’s manager.
Now, we want the Approver of the request to be automatically set to the reporter’s Manager, based on their e-mail. This is easily done using Automation.
5. Configure an Automation rule to set the Approver on created/edited issues
Go to the project administration of your Jira Service Management project and find the “Automation” section.
Configure a rule that will set the Approver field when the value changes for the “Reporter’s approving Manager” mirror field for created and edited issues.
Trigger
When the value of the “Reporter’s approving Manager” mirror field changes for created and edited issues
Action
Set this value to the Approvers field of the same created or edited issue
Here we use the {{fieldChange.toString}} smart value to access the display value of the “Reporter’s approving Manager” mirror field that has changed.
Publish the rule
For this rule to work, make sure the reporter’s Manager has the appropriate permissions to approve requests in the current project.
Next time you submit a request with the hidden Connected item “Reporter’s approving Manager”, you now will see that the reporter’s manager has been automatically set as the Approver of the request:
New to Elements Connect?
If this tutorial has stirred your imagination, why not give it a try?