Using Automation Rule to Approve or Reject an approval

You can use automation in Jira to approve or reject an approval. This is based on a custom field “EA4J Auto Approver Custom Field“. If the value of this custom field is updated, it triggers the approval. This custom field stores the following information:

"EA4J Auto Approver Custom Field": { "approveReject": true, "user": "{{ACCOUNTID}}", "rule": "ed6b9d2a-d529-4b20-a90c-9f085640b1e8" }
  • "approveReject" : can have value “true” or “false”. “true“ value means the approval can be done. “false“ value means the approval is rejected.

  • "user": this will have the user ID of the user on whose behalf you want to execute the approval.

  • “rule“: tis will have the ID of the approval rule which you want to execute.

 

To use automation in Jira to approve or reject an approval, please follow the below mentioned steps:

  • Go to the automation section in Jira and Create a new rule.

  • Select the appropriate trigger.

  • Add an appropriate condition (if required)

  • A sample automation rule will look like:

    • EA4J-automation2.jpg

       

  • Add smart value as:

    •  

      {
      "fields": {
      "EA4J Auto Approver Custom Field": {
      "approveReject": true,
      "user": "{{ACCOUNTID}}",
      "rule": "ed6b9d2a-d529-4b20-a90c-9f085640b1e8"
      }
                   }
      }

    • Here, "approveReject": true means approve; "approveReject": false means reject.

    • “rule“ should have the ID of the rule which needs to be executed.

    • "user" should have the {{ACCOUNTID}} of the user on whose behalf you want to execute the approval.

    • EA4J-automation1.jpg

Note: You can also use Jira API’s to update the value of this custom field.