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,552,362
Community Members
 
Community Events
184
Community Groups

Workaround for: How to look up Assets objects in automation when the AQL contains an "&"

Edited

 

Problem

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

Steps to Reproduce

  1. Create an object with a Name containing an & (e.g. "A & B")

  2. Create an automation rule (schedule trigger, lookup objects action)

  3. Add an IQL like "Name = "A & B"

  4. Execute the automation rule

Expected Results

The IQL is executed and the object with the name "A & B" is returned in the results

Actual Results

An error is returned like "IQL has invalid syntax... token recognition error at..."

 

Workaround

  1. Create a new attribute (Alternative Name) as the alternative attribute for Name.

  2. 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”.

  3. Via automation rule, create a formatted search input to replace the “&” character by “and” word:

    1.png

    (The searchInput can be a custom field value or a variable)
    {{searchInput.replace("&", "and")}}

     

  4. Update the AQL with the formattedSearchInput instead.

    2.png

    • 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).

  5. Test result: 

    3.png

Pros and cons

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:

    4.png

    • Branch on AQL through all objects.

    • Check if {{object.Name}} contains "&".

    • Edit the object to set the Alternative Name = {{object.Name.replace("&", "and")}}:

      5.png 

 

2 comments

I've been using a web request in my automations to grab the object key, which queries for a name that includes the ampersand:

image.png
This will return the object/s you specify.
Like Phong Nguyen _Tony_ likes this

UPDATE: You no longer need this workaround since Atlassian has fixed the bug.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events