Service-Flow Configuration Templates

Response messages

JIRA Adapter converts synchronous responses from JIRA to Response Messages. These messages can be then routed in Service-Flow back to the Endpoint originally sending the message to JIRA. See more in Routing Response messages from JIRA page.

Routing Rule response required

In order to send back JIRA's Issue id to the other Endpoint after creating a new Issue, the response for successful CREATE messages needs to be configured. Jira's response does not include the sender system's id so you need to store it to a conversation attribute in the CREATE rule.

Additions to inbound rules to Jira
  "conversationAttributeMappings" : [
    {
      "type" : "Copy",
      "sourceAttribute" : "[ID_ATTRIBUTE_OF_SENDER_SYSTEM]",
      "targetAttribute" : "sf:conversation:SenderSystemsId"
    },
    {
      "type" : "Copy",
      "sourceAttribute" : "sf:header:operation",
      "targetAttribute" : "sf:conversation:lastSenderSystemOperation"
    }
  ]
Response rule - Success
{
  "name" : "Response From Jira (Success)",
  "flowId" : "[FLOW_ID]",
  "sourceSystemId" : "[JIRA_SYSTEM_ID]",
  "sourceEntityType" : "[JIRA_SYSTEM_ENTITY_TYPE]",
  "targetSystemId" : "[SENDER_SYSTEM_ID]",
  "targetEntityType" : "[SENDER_SYSTEM_ENTITY_TYPE]",
  "responseConditions" : {
    "success" : true
  },
  "action" : "ROUTE",
  "mappings" : [
    {
      "type" : "Copy",
      "sourceAttribute" : "sf:conversation:SenderSystemsId",
      "targetAttribute" : "[ID_ATTRIBUTE_OF_SENDER_SYSTEM]"
    },
    {
      "type" : "Copy",
      "sourceAttribute" : "issue.fields.key",
      "targetAttribute" : "[ATTRIBUTE_OF_JIRA_ID_IN_SENDER_SYSTEM]"
    },
    {
      "type" : "TableTranslate",
      "sourceAttributes" : [
        "sf:warnings"
      ],
      "targetAttributes" : [
        "[COMMENTS_ATTRIBUTE_IN_SENDER_SYSTEM]"
      ],
      "translationTable" : [
        {
          "source" : [
            {
              "match" : "NOT_BLANK"
            }
          ],
          "target" : [
            {
              "valueExpression" : "Message relayed to Jira with warnings: ${sf:warnings}"
            }
          ]
        },
        {
          "source" : [
            {
              "match" : "ANY"
            }
          ],
          "target" : [
            {
              "valueExpression" : "Message succesfully received by Jira"
            }
          ]
        }
      ]
    }
  ]
}
Response rule - Error
{
  "name" : "Response From Jira (Error)",
  "flowId" : "[FLOW_ID]",
  "sourceSystemId" : "[JIRA_SYSTEM_ID]",
  "sourceEntityType" : "[JIRA_SYSTEM_ENTITY_TYPE]",
  "targetSystemId" : "[SENDER_SYSTEM_ID]",
  "targetEntityType" : "[SENDER_SYSTEM_ENTITY_TYPE]",
  "responseConditions" : {
    "success" : false
  },
  "action" : "ROUTE",
  "mappings" : [
    {
      "type" : "Copy",
      "sourceAttribute" : "sf:conversation:SenderSystemsId",
      "targetAttribute" : "[ID_ATTRIBUTE_OF_SENDER_SYSTEM]"
    },
    {
      "type" : "Copy",
      "sourceAttribute" : "issue.fields.key",
      "targetAttribute" : "[ATTRIBUTE_OF_JIRA_ID_IN_SENDER_SYSTEM]"
    },
    {
      "type" : "TableTranslate",
      "sourceAttributes" : [
        "sf:conversation:lastSenderSystemOperation",
        "sf:errors"
      ],
      "targetAttributes" : [
        "[COMMENTS_ATTRIBUTE_IN_SENDER_SYSTEM]"
      ],
      "translationTable" : [
        {
          "source" : [
            {
              "value" : "CREATE"
            },
            {
              "match" : "NOT_BLANK"
            }
          ],
          "target" : [
            {
              "valueExpression" : "Ticket creation failed while ticket was processed in Service-Flow error:\n${sf:errors}"
            }
          ]
        },
        {
          "source" : [
            {
              "value" : "CREATE"
            },
            {
              "match" : "ANY"
            }
          ],
          "target" : [
            {
              "valueExpression" : "Ticket creation failed in Jira:\n${errors}\n${errorMessages}"
            }
          ]
        },
        {
          "source" : [
            {
              "match" : "ANY"
            },
            {
              "match" : "NOT_BLANK"
            }
          ],
          "target" : [
            {
              "valueExpression" : "Ticket update failed while ticket was processed in Service-Flow error: ${sf:errors}"
            }
          ]
        },
        {
          "source" : [
            {
              "match" : "ANY"
            },
            {
              "match" : "ANY"
            }
          ],
          "target" : [
            {
              "valueExpression" : "Ticket update failed in Jira: ${errors} ${errorMessages}"
            }
          ]
        }
      ]
    }
  ]
}

Routing rule - message structure

Special cases and common attributes

Issue Key

The JIRA issue key 'issue.key' will be mapped automatically in JIRA adapter so it should not be mapped in routing rule.

Project Key

It is not necessary to map value for the 'issue.fields.project.key', default value for the JIRA Project key is taken automatically from the System Configurations.

Although, if the 'issue.fields.project.key' is mapped and has a value, it is used instead of the default project.

Id / NameAttribute nameComment
componentsissue.fields.components.nameOnly implemented to support single component, even though JIRA would allow several
commentissue.fields.comment
transitiontransition.name

JIRA has transitions that leads to state changes.
So the name of the transition not the wanted state need to be used.

due dateissue.fields.duedateUsing '2014-12-11T00:00:00.000+02:00' format
descriptionissue.fields.descriptionIssue description
summaryissue.fields.summaryIssue name / topic
custom fieldsissue.fields.customfield_XXXXAll custom fields get the name customfield_RUNNINGNUMBER in JIRA