How to auto-close Alert once JSM Outgoing Integration has created ticket
Asked by Lauren Benson:

I've setup an outgoing JSM Integration to create tickets based on various triggers, some manual, and some automatic. This is working, however I need to subsequently close the trigger Alert (automatically) once the JSM ticket is created.

I looked at OpsGenie Policies, but I cannot see how to identify which Alerts have had JSM tickets created.

Although I think it's a really convoluted way of doing it, I've tried using the JSM Integration Incoming automation, to find the correct alert by extracting the Alias from the ticket description using {{ description.extract( RegEx) }} but it fails with the following error:

```
Substitution error: Exception: 
Substitution of {{description.extract(/(?<=Alias: ).{0,50})/}} for key [alias] failed: 
Lexical error, Encountered: "/" (47), after : "" at *unset*[line 1, column 23]
```

Note: I'm more familiar with JSM than OpsGenie.

Note: in the old JSM integration setup, we would define the JSM ticket creation under the **Close Alert** action filter in the integration setup and that would auto-close any Alerts that triggered the integration. That action was lost with the new integration.


Answers:
author: Lauren Benson
body: FYI - there is now a feature request in place to enable this: [OPSGENIE-881](https://jira.atlassian.com/browse/OPSGENIE-881)

Currently the***issue_created*** event is ignored for the close-alert incoming JSM integration, if the JSM ticket was created by the outgoing alert


author: John M
body: Hi Laura,

If you are using the new integration, you can still use actions to close the alerts. You can expand the 'Incoming automation rules' section and edit the 'close' action:

![2022-08-31_11-43-58 (1).gif](https://community.atlassian.com/t5/image/serverpage/image-id/213754i0B596CEB64F7EBCE/image-size/large?v=v2&px=999 "2022-08-31_11-43-58 (1).gif")

comments: author: Lauren Benson
body: [@John M](/t5/user/viewprofilepage/user-id/4625213) thanks so much for your quick answer. This was the first thing I tried but it does not close the original Alert once the JSM ticket is created.

Could it be an OpsGenie policy or something that's overriding it? Is there an audit log for incoming integrations (like for Jira Automation) that I could check?

Note: I cannot seem to paste or upload my screenshots here (only 300KB)


author: John M
body: Hi [@Lauren Benson](/t5/user/viewprofilepage/user-id/4597468)

Policies would not cause an issue since the integration actions are processed before any policies are processed.

You can see all incoming payload in the debug logs. So if a payload was sent from Jira, it would be in the logs.

The logs would specify in the payload was ignored because it didn't match an action. If you view the logs but aren't able to determine what happened, please open a chat from within Opsgenie or [open a ticket here](https://support.atlassian.com/contact/) and we can request access to take a look at your account.


author: Lauren Benson
body: [@John M](/t5/user/viewprofilepage/user-id/4625213) I've just tried 5 times to raise a support ticket (both OpsGenie and JSM) but it will not allow me to submit (very annoying as it also doesn't tell me why, just that 'Something went wrong, please try submitting your request again.'. I cannot find an email address to send my support request to, so I'm posting here again.

I've checked the debug logs as you suggested:

-- Data Payload is received, shown in logs as: \[incoming\]\[jira-service-management-cloud\]Transformed event data.  
-- Next log with matching eventID and IntegrationID shows as: \[incoming\]\[jira-service-management-cloud\]Matched ignore action.Will discard the data.

There are no ignore actions set in the integration (only the close Alert action).

Note that issue_created Events that trigger the Incoming integration, but were not created by the Outgoing Integration do not get ignored. Instead, the logs show that the close-alert action attempts to run 5 times before failing (as expected). No similar attempts are logged for the alerts that triggered the outgoing integration.


author: John M
body: Hi [@Lauren Benson](/t5/user/viewprofilepage/user-id/4597468) ,

It sounds like we need to take a look at the account. Can you open a chat from within Opsgenie so we can request access?


Tags: cloud

integration

jira-service-management-cloud