Update Jira after Ironclad Approval (Automation Rule)

Goal

Update a Jira issue after an approval occurs in Ironclad.

Overview

This solution pattern provides a method for updating a Jira issue with approval information from Ironclad. In this example, a Legal team will work and provide its approval in Ironclad. This approval will be reflected in Jira by updating a field on the issue.

Ironclad’s workflow_approval_status_changed webhook will be used to notify Jira of approval events. Jira will filter the webhooks for relevant events, retrieve information from Ironclad, and update the Jira issue. The following figure shows the API request flow between Jira and Ironclad.

Prerequisite: The Launch Ironclad Workflow from Jira (Automation Rule) solution pattern must be completed before configuring this solution pattern. That solution pattern stored key Jira information (Jira Issue ID) in the Ironclad workflow and key Ironclad workflow data (Ironclad Workflow ID) in the Jira issue.

1746

API Request Flow

Details

The following figure shows the components in the Jira automation rule:

  1. Listening for the Ironclad workflow_approval_status_changed webhook.
  2. Sending a request to retrieve the Ironclad workflow's information.
  3. Updating the Jira issue.
375

Jira Automation Rule

Configure Ironclad Workflow

  1. In Ironclad, create an approver that represents the Legal approver if it does not already exist. Name the approver Legal. Step five will filter for this value so it must be an exact match. If you rename it, be sure to rename the approver value that is filtered for in step five.
    1. Click Workflow Designer > Review > Add approver or Add next approver.
    2. Enter Legal as the approver name in place of New Approver.
    3. Select a group that you wish to use as the approver.
    4. Click publish to save and deploy your changes.
1221

Configure Jira Issue

  1. In Jira, add Legal Approval as a dropdown field with (1) pending and approved as options and (2) pending selected as the default. The Jira automation rule will update this field.
1003

Jira Automation - Configure Trigger

  1. In Jira, create a new automation rule and configure the trigger.
    1. Click Create Rule and select Incoming Webhook as the trigger. This component will receive the workflow_approval_status_changed webhooks from Ironclad.
    2. Copy the Webhook URL for use in step four.
    3. Name the rule (e.g., 3. Ironclad Workflow Approval (Legal) - Update Jira Data).
1368

Ironclad - Configure Webhook

  1. In Ironclad, create a workflow_approval_status_changed webhook using the Jira webhook URL.
    1. Click [Your Name] > Company Settings > API > Webhooks > Create Webhook.
    2. Paste in the Jira webhook URL from the Jira automation rule you just created, and select the workflow_approval_status_changed webhook.
    3. Click Create to save and activate the webhook.
649

👍

Additional Ironclad Webhooks

This solution pattern updates Jira after an Ironclad approval. Ironclad has other webhooks, including a workflow_completed webhook, that can be used to trigger update processes when workflows are completed.

See Webhook Event Types for a list of webhooks or the Update Jira after Ironclad Workflow Completed guide for an example using Zapier.

Jira Automation - Filter for Relevant Webhooks

  1. In Jira, return to the Jira automation rule you started. Create the three conditions that follow to filter for webhooks from a relevant approval. For each condition, add a new component and select New Condition > Advanced compare condition.
    1. Create a condition to check that the webhook is for an approval status change. Enter {{webhookData.payload.event}} as the first value, select equals as the condition, and enter workflow_approval_status_changed as the second value for comparison.
    2. Create a condition to check that the approval is from Legal. Enter {{webhookData.payload.approvalName}} as the first value, select equals as the condition, and enter Legal as the second value for comparison.
    3. Create a condition to check that the approval status has been updated to approved. Enter {{webhookData.payload.status}} as the first value, select equals as the condition, and enter approved as the second value for comparison.

📘

Ironclad Webhook Behavior

Ironclad webhooks are sent for all Ironclad workflows. Relevant webhooks are identified by filtering based on the event type and approval details.

A second level of filtering will be applied in step seven, after retrieving the workflow's template ID, to verify that the relevant workflow type is involved.

373
  1. In Jira, add a Send Web Request component. This component will be used to retrieve the workflow's data for further filtering and processing.
    1. For URL, enter https://[YOUR_IRONCLAD_DOMAIN]/public/api/v1/workflows/{{[WORKFLOW_ID]}} to call the endpoint.
      1. Replace [YOUR_IRONCLAD_DOMAIN] with the domain where you are making the comment (e.g., preview.ironcladapp.com, demo.ironcladapp.com, ironcladapp.com).
      2. Replace [WORKFLOW_ID] with the custom field ID you created in Jira to store the Ironclad Workflow ID.
    2. For Headers, add an Authorization header.
    3. For HTTP Method, select GET.
    4. For Web request body, select Empty.
    5. Check the Delay execution of subsequent rule actions. . . checkbox and click Save.
903
  1. In Jira, add an Advanced condition compare component. This component will perform one final filter to verify that the inbound event is related to a relevant workflow design.
    1. Retrieve the template ID of your workflow using the steps outlined in Getting Started - Unique Ids (Workflows).
    2. In the condition, enter {{webhookResponse.body.template}} as the first value, select equals as the condition, and enter the template ID you retrieved as the second value for comparison.
543

Jira - Update Issue

  1. In Jira, add a Create variable component. We will use this variable to store the Jira issue ID from the Ironclad workflow metadata; it will then be used to find the relevant Jira issue and edit it.
    1. Locate the Ironclad attribute ID you used to store the Jira issue ID when you launched the workflow. You should be able to retrieve it by looking back at the automation rule you created in the Launch Ironclad Workflow from Jira (Automation Rule) guide.
    2. Enter jiraIssueID as the variable name and {{webhookResponse.body.attributes.[YOUR_WORKFLOW_ATTRIBUTE_ID]}} as the smart value.
    3. Note: Creating a separate variable is technically not required, but it creates a cleaner variable name for later use.
811
  1. In Jira, add a For JQL branch component to locate the Jira issue and edit it.
    1. Click New branch > Branch rule / related issues.
    2. For Type of related issues, select JQL.
    3. For JQL, enter the variable you created in the preceding step: "{{jiraIssueID}}".
    4. Uncheck the checkbox for Only include issues that have changed since the last time this rule executed.
    5. If relevant, restrict the rule to a specific project to minimize usage.
    6. Click Save.
903
  1. In Jira, within the JQL component, add an Edit issue action component.
    1. In the Choose fields to set dropdown, check the Legal Approval field that we created and select approved as its value.
    2. If desired, add any additional changes you wish to make to the issue.
693
  1. Publish your Jira automation. Congratulations, you have an automation rule that can update a Jira issue when a specific approval has occurred!