How to lookup Objects on an Assets Objects field using values from a Select List (multiple choices) field in Automation
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Environment
Have a Select List (multiplechoices) that correspond to attributes in your Objects
Use that field on your Request Type form, instead of the actual Assets Objects field
Customers will often select more than one option
A Select List (multiple choices) smart value can't be dropped straight into an AQL Label IN (...) clause: options that contain spaces produce invalid AQL, and the rule errors out. You must wrap each option in double quotes first.
Problem
A Select List (multiple choices) field smart value {{issue.customfield_xxxxx}} can't be used in an AQL to find the correct objects due to how the automation will output the list of options selected.
For instance, let's assume that a customer selected the following options for their office desk setup: Macbook Pro, 24in Monitor, Wireless Mouse, Wireless Keyboard. Using the {{issue.customfield_xxxxx}} smart value in a Label IN ({{issue.customfield_xxxxx}}) IQL, we'd get the following actual AQL:
Label IN (Macbook Pro, 24in Monitor, Wireless Mouse, Wireless Keyboard)However, because those options contain spaces, the AQL syntax is invalid, and the automation will throw an error.
Solution
We need to manipulate that list so each option is inside double quotes.
Use this smart value to quote and comma-separate each selected option:
{{#issue.customfield_xxxxx}} "{{value}}"{{^last}},{{/}}{{/}}
Replace customfield_xxxxx with your Select List field's smart value. For the selections Macbook Pro, 24in Monitor, Wireless Mouse, Wireless Keyboard, this produces a valid AQL: Label IN ("Macbook Pro", "24in Monitor", "Wireless Mouse", "Wireless Keyboard").
Using the same example above, that smart value will give us the following AQL:
Label IN ("Macbook Pro", "24in Monitor", "Wireless Mouse", "Wireless Keyboard")With that list properly separated and quoted, the AQL should work and allow Assets to find the correct objects.
To confirm it's working, run the rule against a test issue with multiple options selected, and verify that the Assets Objects field is populated with the matching objects (check the rule audit log for the resolved AQL).
Was this helpful?