Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,461,304
Community Members
 
Community Events
176
Community Groups

How to enable integration with OpsGenie?

Hello,
I had to install OpsGenie Edge Connector on our test Jira server but when I am trying to submit alert on OpsGenie side, I can't get Jira SD to make ticket from that alert. Communication works from OpsGenie (OG) to Jira SD server. This is part of the output.txt file:
WARNING:root:[createIssue] Could not execute at Jira Service Desk; response: b'{"errorMessages":[],"errors":{"components":"Component/s is required."}}' status code: 400
In the settings for that project there are fields which are needed for creation of the ticket. "Component/s" is there as hidden. I was not able to remove it completely. When I made it blank - didn't help
I tried to define "Component/s" on OG side but no success as well. I am still getting above warning.
Can you please help me get thru that error message so Jira SD could create tickets based on OG alerts?

1 answer

1 vote
Robert Atlassian Team Jul 02, 2020

Hi @pavol_cvincek01 !

 

If the Jira project and issue type you are sending alerts to have (non-standard) required fields (like a component), there are two main options for getting them filled:

 

  1. Use Manual Issue Creation for Jira Software. This flow will essentially bring up the same Create Issue modal from Jira, including custom fields. The downside of this option is it isn't automated; a user would have to click the "Create Issue" button in an alert. 2020-07-02_11-50-38_01.png
  2. Customize the OEC script to include component in the createIssue action: https://github.com/opsgenie/oec-scripts/blob/master/Jira/scripts/actionExecutor.py#L113

    This would end up looking something like this:
     content_params = {
    "fields": {
    "project": {
    "key": project_key
    },
    "issuetype": {
    "name": issue_type_name
    },
    "summary": queue_message.get("summary"),
    "description": queue_message.get("description"),
    "labels": [toLabel.replace("\\s", "")],
    "components": [{
    "id": component
    }]
    }
    }

Hope this helps!

Hello Robert,
First of all, thanks a lot for your feedback. Option 1 is not suitable for us so I went for second one. I added "compoment" there as suggested but after I started OEC I could see there error saying " NameError: name 'component' is not defined". I tried to define it by adding "import component" on the top of the actionExecutor.py but another problem appeared - "ImportError: No module named 'component". It would be great if you would be able to advice with this as well.
Thank you in advance and have a nice day.

Robert Atlassian Team Jul 13, 2020

Hi @pavol_cvincek01 !

 

The "component" I had included in that snippet was an example variable name, so there's no need to do any additional imports in the script.

You would need to define "component" somewhere in the script, or at least substitute it with your component ID:

 

 content_params = {
"fields": {
"project": {
"key": project_key
},
"issuetype": {
"name": issue_type_name
},
"summary": queue_message.get("summary"),
"description": queue_message.get("description"),
"labels": [toLabel.replace("\\s", "")],
"components": [{
"id": "12345"
}]
}
}

Hope this helps clarify things a bit!

Hi @Robert 
Yep, I used our value for component at first but no success as mentioned above. Afterwards I changed "id" to "name" and it finally works. Thanks a lot for that, it helped significantly.


Unfortunately now I can see this there:
"WARNING:root:[createIssue] Could not execute at Jira Service Desk; response: b'{"errorMessages":[],"errors":{"customfield_13040":"Field Customer Request Type is required.","customfield_15340":"Field Did It work in the past? is required."}}' status code: 400"

Field Customer Request Type should be "Alerts"
Field Did It work in the past? should be "Yes"

When I tried the same approach like for "components" I wasn't successful. Can you advice how the code should looks like?

Thanks in advance and have a nice day.

Robert Atlassian Team Jul 15, 2020

@pavol_cvincek01 I think you're on the right track by following the same process as the first field. My first guess is those fields might be a different "type" of custom field though, so the format in the API request may need to be modified.

 

This page has some great examples in the Creating an issue using custom fields section. I'd check the types of those custom fields and make sure they're using the format mentioned in those docs.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events