There is a known bug about looking up Assets (Insight) objects in Jira automation when the AQL contains an “&” character throws an error and returns no results: https://jira.atlassian.com/browse/JSDCLOUD-11142
Create an object with a Name containing an & (e.g. "A & B")
Create an automation rule (schedule trigger, lookup objects action)
Add an IQL like "Name = "A & B"
Execute the automation rule
The IQL is executed and the object with the name "A & B" is returned in the results
An error is returned like "IQL has invalid syntax... token recognition error at..."
Create a new attribute (Alternative Name) as the alternative attribute for Name.
Set the alternative value without “&” to the new attribute Alternative Name for all objects that contain the “&” character. For example: If the Name is "A & B", the Alternative Name should be set to “A and B”.
Via automation rule, create a formatted search input to replace the “&” character by “and” word:
{{searchInput.replace("&", "and")}}
Update the AQL with the formattedSearchInput instead.
BEFORE:
key IS NOT EMPTY AND Name = "{{searchInput}}"
AFTER:
key IS NOT EMPTY AND (Name = "{{formattedSearchInput}}" OR "Alternative Name" = "{{formattedSearchInput}}")
(The part "key IS NOT EMPTY" is just a test AQL to remind using the parentheses () after this test clause - without the parentheses () it will not work as expected).
Test result:
Pros
The original attribute value with “&” is preserved and can be found via AQL.
Cons
Have to add a new alternative attribute.
Have to populate the alternative attribute for all affected objects.
However, we might automate this step if there are too many objects:
Branch on AQL through all objects.
Check if {{object.Name}} contains "&".
Edit the object to set the Alternative Name = {{object.Name.replace("&", "and")}}:
UPDATE: You no longer need this workaround since Atlassian has fixed the bug.
I've been using a web request in my automations to grab the object key, which queries for a name that includes the ampersand:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.