Setting priority to tickets in JSM generated from Opsgenie alerts
Asked by Andr?s Enrique C?rdenas:

I have an integration with Zabbix setup, and I have already modified the integration, so it matches the P1-P5 schema using our Zabbix priority (so disaster is P1, high P2, warning P3, etc, etc). This is working perfectly; the alerts are created accordingly:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/246312i54728B6BC522B26A/image-size/large?v=v2&px=999 "image.png")

I have another integration that takes this alert and creates an Incident issue in Jira, this works fine, but every incident that creates is raised with the equivalent of a P3 ticket (in our case we have set it up as P2 is High, P3 is Medium, P4 is low, P5 is informational.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/246315i66C447CE77370B8C/image-size/large?v=v2&px=999 "image.png")

all of the tickets are being created as "Medium".

The last log from this integration looks like this:

{  
"_outgoingData": {  
"_headers": {  
"-Content-Type": \[  
"application/json;charset=UTF-8"  
\],  
"-Authorization": \[  
"Basic............."  
\]  
},  
"integrationType": "JiraServiceDesk",  
"_payload": {  
"_fields": {  
"summary": "\[Zabbix\] System audit policy was changed",  
"-labels": \[  
"----"  
\],  
"_project": {  
"key": "..."  
},  
"_issuetype": {  
"name": "Incident"  
},  
"description": ".........."  
}  
},  
"integrationName": "Opsgenie to JIRA"  
},  
"alertLogOwner": "System",  
"alertId": "......",  
"alertLogType": "system"  
}

I don't see anything reated to the priority in there...

I tried doing the same that I did with the Zabbix alerts and modify the priority parameter, but I couldn't get it to raise the ticket with the right priority.

I'd appreciate any guidance you can provide, thanks!


Answers:
author: Oday Rafeh
body: Hi [@Andr?s Enrique C?rdenas](/t5/user/viewprofilepage/user-id/5166356)

I will try to help you here,

To set the priority of the Jira Service Management **(JSM)** tickets generated from **Opsgenie alerts** , you'll need to map the priority from **Opsgenie** to the corresponding priority in **JSM**. You can do this by modifying the payload in the Opsgenie to Jira integration.

Please Follow these steps:

* In Opsgenie, navigate to the "Integrations" page.
* Locate your Jira Service Management integration and click on the "Settings" button (gear icon).
* Scroll down to the "Create Jira Issue" section and click on "Edit".
* In the "Create Jira Issue" action, you need to add the priority mapping in the payload. You can do this by including the priority field in the _fields section of the payload.

I wrote an example of how you can map Opsgenie priority levels to Jira priorities:

```
{ "_fields": { "summary": "Your summary here", "labels": ["label1"], "project": {"key": "YourProjectKey"}, "issuetype": {"name": "Incident"}, "description": "Your description here", "priority": {"name": "{{#equalsString alert.priority 'P1'}}High{{/equalsString}}{{#equalsString alert.priority 'P2'}}Medium{{/equalsString}}{{#equalsString alert.priority 'P3'}}Low{{/equalsString}}{{#equalsString alert.priority 'P4'}}Lowest{{/equalsString}}{{#equalsString alert.priority 'P5'}}Informational{{/equalsString}}"} } }
```

In this example, the priority field in Jira is set based on the priority value of the alert in Opsgenie. Make sure to replace the priority names with the appropriate values for your Jira instance.

* Save your changes.

Now, when an alert is created in Opsgenie, the corresponding JSM ticket should be created with the correct priority based on the mapping in the payload.

I hope to hear form your side as soon as you get any results.

comments: author: Andr?s Enrique C?rdenas
body: thanks! I'll try and let you know how it goes :D


author: Andr?s Enrique C?rdenas
body: Hi Oday,

We might have a different version of Opsgenie or Jira integration, I don't see the edit or gear icon in the integrations page. This is how it looks on the "create jira issue" no option to edit the action there:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/247119i5E866AB5B096C94A/image-size/large?v=v2&px=999 "image.png")

below this I see on the alert fields there's the priority, but I have not been able to set the parameters as per your example:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/247120i9569FD28ECD67FCB/image-size/large?v=v2&px=999 "image.png")

not sure where to change this


author: Markus Ernst
body: [@Andr?s Enrique C?rdenas](/t5/user/viewprofilepage/user-id/5166356) did you find an answer? :-)