Running workflows in Trelica from Jira

Many organizations use Atlassian tools to manage IT helpdesk tasks. Whilst Trelica can take leaving dates from HR systems and run workflows at the right time, it's sometimes easier to work within existing processes.

In this example we assume that offboarding tasks are raised within Jira, and someone on the service desk will trigger the offboarding process at the correct time.

You can also refer to a more sophisticated example related to onboarding


Scenario

In this simplified example we're going to create an automation in Jira that will run a workflow in Trelica to remove an account in Google Workspace.

We have a Jira project called Offboarding and we've added a text field called Email address of leaver which we will use to tell Trelica which user to offboard:

Create the Jira Automation

Go to Project settings > Automation and click Create rule:

Every Jira automation has a trigger. You could use anything you want (e.g. transitioning to a specific status), but in this example we have chosen Manual trigger from issue.

You can choose who can run Jira triggers and you might want to restrict access to members of the IT team.

The second step is to add a New action.

Search for, and then choose Send web request:

We now need to enter a web request URL:

This is going to be provided by Trelica, so let's now switch to Trelica and configure the workflow.

Test the data flow from Jira to Trelica

In a new tab in your browser, log in Trelica, go to Admin > Workflows and create a new workflow from scratch.

We'll call it Offboard employee, and the trigger will be API webhook:

We'll start by testing things out to get the basics going - click Test Webhook:

Trelica will provide you with a special URL for testing - click to copy it:

Keeping the Trelica dialog open, go back to Jira.

  1. Paste in the URL from Trelica
  2. Select POST as the HTTP method
  3. Select Custom data as the Web request body

Jira supports several 'payload' types for the web request body, including Automation format and Jira format. These tend to include a lot of superfluous information and can be hard to follow, so we generally recommend using Custom data as it lets you see what gets sent more clearly and gives more control over the structure.

For the Custom data, paste in the following:

{
"issueKey": {{issue.key.asJsonString}},
"issueStatusName": {{issue.status.name.asJsonString}},
"issueSummary": {{issue.summary.asJsonString}},
"issueTypeName": {{issue.issueType.name.asJsonString}},
"leaverEmail": {{issue.Email address of leaver.asJsonString}}
}

The 'double braces' are Jira smart values which will be substituted when the workflow runs.

Jira lets you test very easily: expand Validate your web request configuration and enter the issue key for an issue in the project.

Then click Validate:

You should see a 201 Created response in Jira, and if you go back to your Trelica tab you will see what Jira posted:

Verify that it's Jira calling the Trelica workflow

You can close the Test webhook dialog in Trelica and we will configure the rest of the trigger. 

First check Verify request.

Although the Trelica URL is reasonably unguessable, we don't want anyone who knows the URL to be able to trigger a workflow.

A simple way to do this is to get Jira to send a shared secret value that Trelica can check.

Enter x-secret as the Header name and click the pencil icon to set a value.

You can type in a value but it's easiest to click Generate and Trelica will give you a random value.

Copy the secret and now paste this into Jira.

Set the header name to x-secret, and we also recommend clicking the Hidden checkbox in Jira too:

We now want to set the Context of the Trelica workflow. 

For this we want to:

  • choose Person
  • set the Type to email
  • enter leaverEmail as the JSON path

The final step is to correct the URL in Jira.

The URL Trelica provides when you test the webhook is purely for testing and a different URL is used for triggering workflow runs.

Copy this from Trelica and paste it into Jira:

Jira configuration is now complete, so scroll down and Save the automation:

Now you can enter a name e.g. Offboard user, and enable the automation:

We recommend only letting other admins edit the rule, since it contains the shared secret with Trelica.

Click Turn it on to enable the automation.

Finish the workflow in Trelica

Add some actions to your workflow - in this case we're going to suspend a user in Google Workspace by clearing down basic details like aliases, revoking access and suspending the account.

Click Save Draft to save your workflow and Enable it before it can be run from Jira.

If a Trelica API webhook workflow is not Enabled then it cannot be triggered

Run the automation in Jira

We created a form to put the basic details into the Jira Issue. The most important thing is that the email address of the leaver must be populated as Trelica will use this to work out which user to deprovision:

When you've created an issue, then find it and open it up:

To run the automation click Actions and choose Offboard user (or whatever you named your automation):

Jira will confirm that the automation has been run.

Check what happened in Jira and Trelica

To check things from the Jira side, view the Automations Audit log:

To check what happened in Trelica, click on the workflow run:

Notice how you can expand the JSON to see what Jira posted:

 

Was this article helpful?

1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.