Creating automation rules to add webhook in JIRA

Automation rules allow you to automate actions within your system based on the criteria that you set.

Automation rules are made up of three parts: triggers that kick off the rule, conditions that refine the rule, and actions that perform tasks on your site. For more detail, refer Automation: Basics

The Following steps are provided to create the below two rules, you can create more rules as necessary.
  • Update Maximo IT incident
  • Create Maximo IT work Log

Update ICD incident

  1. Click JIRA ADMINISTRATION on the right-hand top corner, select System from the drop-down options.
  2. On the System tab, select Automation rules on the left-hand side navigation panel.
  3. On the Automation page:
    • Click Create rules.
    • On the Recommended section, click Field value changed rule.
    • On the Field value changed:
      • Select fields in the Fields to monitor for changes box, such as summary, priority, status, etc.
      • Select fields in the For box, such as Edit issue, Transition issue, etc.
      • Click Save.
    • On the Add component, click the New action component.
    • On the New action component, click Send web request under the Notification section.
    • On the Send web request page, do the following:
      • In the Webhook URL box, enter Maximo IT automation script as webhook URL, such as http://<computer_name_or_IP_address>:<Port>/maximo/oslc/script/<UPDATEINCIDENT>?_lid=<username>&_lpwd=<password>
        Note: The script name in the above webhook URL must be the same as the automation script name created in Maximo IT, for example, the UPDATEINCIDENT automation script is created in Creating automation script.
      • Header is optional.
      • HTTP method must be POST.
      • In the webhook body box, select Issue data from the drop-down options.
      • Click Save.
    • On the Add component, enter the name for the rule in the Name your automation box. In our example use case, name is the Update Maximo IT incident.

Create ICD work Log

  1. Click JIRA ADMINISTRATION and select System from the drop-down options.
  2. On the System tab, select Automation rules on the navigation panel.
  3. On the Automation page: .
    • Click Create rules.
    • On the Recommended section, click the Issue commented rule.
    • On the Issue commented, click Save.
    • On the Add component, click New action component..
    • On the New action component, click Send web request under the Notification section.
    • On the Send web request page:
      • In the Webhook URL box, enter Maximo IT work log object as webhook URL, such as http://<MAXIMOIT_SERVER_IP_ADDRESS>:<Port>/maximo/oslc/os/script/CDUIWORKLOG?_lid=<username>&_lpwd=<password>
      • Header is optional.
      • HTTP method must be POST.
      • In the webhook body box, select Custom data from the drop-down options.
      • In the Custom data box, fill the below JSON data. See below note for the custom field value in below Custom data.
        {
            "spi:class": "INCIDENT",
            "spi:description": "{{issue.comments.last.body}}",
            "spi:logtype": "CLIENTNOTE",
            "spi:modifyby": "{{issue.comments.last.author.name}}",
            "spi:logtype_description": "Client Note",
            "spi:clientviewable": false,
            "spi:createby": "{{issue.comments.last.author.name}}",
            "spi:recordkey": "{{issue.fields.customfield_XXXXX}}"
        }
        Note:
        1. In above custom data, enter custom field that you noted for MAXIMOITTICKETID in Creating custom fields in JIRA. For example "spi:recordkey": "{{issue.fields.customfield_10201}}"
        2. For worklog synchronization, in the automation rule, custom JSON data is passed that is required by Maximo IT API to update worklog in Maximo IT.
      • Click Save.
    • On the Add component, enter the name for the rule in the Create Maximo IT work Log box.