Automation rule fails to create issue due to an Assets custom field validation error
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
During a new issue creation within an automation rule, the Create issue event fails with the error Validation failed for Insight object (customfield_12345).
Diagnosis
This behavior has been seen with various triggers and primarily to impact the Create issue action. During the automation issue creation event, the Assets custom field is attempted to be populated using an AQL query, however editing the field fails due to a validation error resulting in the overall event to fail. The audit log entry returns a Some Errors status. The error seen in the automation audit logs:
An example rule configuration where this issue can occur:
AQL in use:
"Software ID" = {{object.Software ID}}
Cause
The issue occurs due to mismatch error when multiple Assets Objects are returned on the AQL used to set the field value. When the Assets custom field has Schema filtering configured and the automation rule tries to set the value to an Object that does not match the filter, a validation error occurs.
Solution
Adding further filtering to the AQL query that the automation rule is executing resolves the issue as it filters out those Objects that would not validate against the Assets custom field. An example may be to add filtering for objectSchema, objectSchemaId, objectType or objectTypeId. The screenshot below shows the corrected AQL:
AQL in use:
objectSchema = Applications AND "Software ID" = {{object.Software ID}}
Please read the support article Set up the Assets objects custom field for further information on configuring Assets custom fields and Using Assets Query Language (AQL) syntax for examples and details on the AQL syntax.