Alert outgoing rules for JIRA
Asked by joana:

Hello,

How can we setup the jira integration, to properly reflect the JIRA ticket states if there's custom states in the JIRA ticket type that link to the alerts?

The current option is very limited in customization:

![Screenshot 2022-06-03 at 14.42.32.png](/t5/image/serverpage/image-id/200523iAF91E50060CADA7B/image-size/large?v=v2&px=999 "Screenshot 2022-06-03 at 14.42.32.png")

I see only a way to do something like this but it would require additional effort to setup: an action to update the ticket on JIRA using a REST endpoint that would actually manage that through the API. Is there any way to avoid that?


Answers:
author: Nick H
body: Hi [@joana](/t5/user/viewprofilepage/user-id/4844710) ,

The action mapping from Opsgenie \>\> JSM cannot be changed. The default options are only available to select at this time.

With our older JSM integration framework, you can leverage [OEC](https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-jira-service-management/#Integration-via-OEC--for-On-Premise-Jira-Service-Management-Usage-) to map to custom statuses in your JSM instance through.

With this, you would install the OEC service on a server, and it would sit in the middle of Opsgenie and JSM. Opsgenie alerts would send to OEC, which would then execute a script to create the issue in JSM. You can modify the OEC script to customize things such as configure it to set an Opsgenie alert field as a required custom field in JSM, map to a custom status, etc.

Although the doc says "for On Premise Jira Service Management Usage" we see a number of cloud customers using OEC for something a bit more custom, and use cases such as this.

Or - instead of using OEC, you could configure an automation rule on the JSM side to transition the issue to a certain status when the alert is closed. What typically works well is setting the action mapping on the Opsgenie side to add a comment to the issue when an alert is closed:

![jsm1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/200528i677075C49C4A6889/image-size/large?v=v2&px=999 "jsm1.jpg")

Then add an automation rule that filters on the comment, and transitions the alert to a specific status. That rule might look something like this:

![jsm2.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/200531iEAA60B9AC76CAB31/image-size/large?v=v2&px=999 "jsm2.jpg")

JQL:

```
comment ~ "closed alert"
```

Test:

![jsm3.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/200533iBC2D61D6D44B4FB0/image-size/large?v=v2&px=999 "jsm3.jpg")![jsm4.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/200532i924F46CA58C44A51/image-size/large?v=v2&px=999 "jsm4.jpg")

Hope that helps!

comments: author: joana
body: sorry for the delay. In your answer you mention JSM but I'm using only JIRA on the cloud (not self hosted). Would this work, if we use this integration?

Another issue that I found is the lack of support for issue updates in the JIRA integration with opsgenie. In case there are changes to the values we use to assign teams in opsgenie we can't propagate them. Would this OEC trick also help on that?


author: Nick H
body: Yes, the idea would be the same for Jira as it is for JSM.

As for the latter - seems like when the Jira issues are updated, you want those reflected on the Opsgenie alert (or vice versa)? That unfortunately isn't really possible at this time.


Tags: cloud