Create Jira issue Insight automation rule not working
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Insight Automation rules "Create Jira issue" does not create a Jira issue
By enabling the debug package for Insight Automation , The following appears in the insight_automation.log
2022-04-07 16:18:26,220 [http-nio-127.0.0.1-8080-exec-785 url: /rest/insight/1.0/automation/rule/11/events/run; user: psubramaniyan] | AutomationRuleCreateJiraIssueAction, Unexpected error: com.atlassian.jira.util.SimpleErrorCollection@285051f1[errors={customfield_20991=Strategy is required.},errorMessages=[],reasons=[VALIDATION_FAILED]]
com.riadalabs.jira.plugins.insight.common.exception.JiraServiceInsightException: com.atlassian.jira.util.SimpleErrorCollection@285051f1[errors={customfield_20991=Strategy is required.},errorMessages=[],reasons=[VALIDATION_FAILED]]
at com.riadalabs.jira.plugins.insight.services.jira.JIRAServiceImpl.createIssue(JIRAServiceImpl.java:577)
at com.riadalabs.jira.plugins.insight.services.jira.JIRAServiceImpl.createIssue(JIRAServiceImpl.java:530)
at com.riadalabs.jira.plugins.insight.services.automation.action.AutomationRuleCreateJiraIssueAction.doActionSafe(AutomationRuleCreateJiraIssueAction.java:64)
at com.riadalabs.jira.plugins.insight.services.automation.action.AbstractInsightAutomationAction.doAction(AbstractInsightAutomationAction.java:107)
at com.riadalabs.jira.plugins.insight.services.automation.rule.impl.AutomationRuleEngineImpl.executeAction(AutomationRuleEngineImpl.java:675)
Diagnosis
Environment
Any Insight version
Diagnostic Steps
There is an Insight Automation rule to create a Jira issue with certain criteria is met
The user (either the logged-in user or the user that you select for running scheduled events) has at least the Insight Users role for the schema and permissions to create a Jira issue within the project selected
- There is a Jira field or a custom field set to be required
Cause
Insight has a fixed form for creating issues with Automation rules. It does not allow to include other custom fields. If you have a custom field or Jira field set to be required on creation, the automation rule will fail.
Workaround
You could create a Jira issue using Insight Automation with the required fields as follows:
- Use Execute Groovy Script
- This action allows a triggered rule to execute a Groovy Script
- Use HTTP request
- This action allows a triggered rule to make HTTP request and add the mandatory values to the API's payload