Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Selecting multiple object assets in insight object field using jira automation

Adam Galdeman May 17, 2023

I am currently trying to take data from a multi - select field that the customer fill out and then lookup objects that match the values in this field. Then I would like to add those objects to an insights custom object field on my issue using Jira automation.

 

Currently I am able to use advanced branching to edit the each value in the multi-select list to match the key of the object using split. 

 

Then I am using lookupObjects to get the key for the two items from the multi select list, but when i try and edit the insight objects field of my issue it only adds one of the two items shown in the log output of lookupObjects.

 

Wondering what i am doing wrong, or if anyone has a better way of doing this.

 

Any help would be greatly appreciated.

image_720.pngimage_720.pngimage_720.png

image_720.pngimage_720.png

1 answer

1 vote
Marini Marini
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2023

Hi @Adam Galdeman 

Welcome to the Atlassian Community!

Can you please check the Asset custom field Double Picker Serial Number# configuration and make sure it is configured to accept multiple objects?

image.png

Cheers,

Marini

Marini Marini
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2023

Hi @Adam Galdeman 

Additionally, here is how we can make your automation rule more efficient:

  • In the lookup object AQL, no need to use Advanced Branching. You can use the following (assuming the Packer Serial Number (NZ) is created as Select (Multiple) types).
objectType = "Double Apple Pickers" and "Packer serial number" IN ({{#issue.Packer Serial Number (NZ)}}"{{value}}"{{^last}}, {{/}}{{/}})

The above smart value will display the following output (assuming the Packer Serial Number (NZ) has 3 values e.g. APB-123, APB-345, and APB-567)

"APB-123", "APB-345","APB-567"

So, the AQL is translated to:

objectType = "Double Apple Pickers" and "Packer serial number" IN ("APB-123", "APB-345","APB-567")
  • Then, edit the asset custom field using the following:
Key IN ({{#lookupObjects}}"{{.}}"{{^last}}, {{/}}{{/}})

The above smart value will display the following output (assuming the {{lookupObjects}}  return 3 values e.g. AP-123, AP-345, and AP-567

"AP-123", "AP-345", "AP-567"

So, the AQL is translated to:

Key IN ("AP-123", "AP-345", "AP-567")

Your automation rule will only have 3 components:

  1. Trigger: When issue is created
  2. And: Lookup objects
  3. And: Edit issue fields

Cheers,

Marini

Adam Galdeman May 22, 2023

Thanks heaps for this i think its definitely a better way to go for simplification.

I think I have got the object field set to allow multiple as I can definitely select multiple manually.

Sorry i dont think i made it super clear, but the reason i was using the advanced branching is because the values in the Packer Serial Number (NZ) list aren't identical to the key for the objects. 

For example:

The packer serial number (NZ) contains the following: "APB-123 Packer 1" , "APB-345 Packer 2"

The objects on the other hand are only identified as "APB-123" and "APB-345". 

I was using the advanced branching to split each value on white spaces individually and then taking the first item in the split list.



Does this make sense?

There may be a way similar to what you have done with the single lookup object that can do this?

Thanks heaps for your reply again, much appreciated.

Adam Galdeman May 22, 2023

Hey @Marini Marini 

So I have managed to figure out that splitting part i mentioned above and have got it working so thanks heaps, and dont worry about that.

I now have a another issue i'm hoping you will be able to help me with.

There are actually two types of serial numbers that can be selected from the Packer serial number (NZ) APB-123 and AP-123 and each have their respective objects which are a different object type unfortunately.

My question is, Is there a way to check every item in the list for Packer Serial Number (NZ) so that i can call the appropriate lookup object for the serial number that returns?

 

I have tried using the if else condition however it only checks the first value in the list which is always the serial number AP-123 and does not meet the condition for APB-123.

Do you know of a way to check if any item in the list contains the regex not just the first?

image (4).png

Marini Marini
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2023

Hi @Adam Galdeman 

Let me know if I understand the requirements correctly.

  1. Packer serial number (NZ) may have values such as APB-123 and AP-123
  2. If the value starts with APB-xxx, you would like to lookup the asset object in the:
    1. object schema: Double Apple Pickers
    2. objectType: e.g. ObjectTypeA
  3. If the value starts with AP-xxx, you would like to lookup the asset object in the:
    1. object schema: Double Apple Pickers
    2. objectType: e.g. ObjectTypeB

In this case, your lookup AQL can be as follow:

objectType IN ("ObjectTypeA", "ObjectTypeB") AND "Packer serial number" IN ({{#issue.Packer Serial Number (NZ)}}"{{value}}"{{^last}}, {{/}}{{/}})

Then you can edit the asset custom field, Double Packer serial number#, with the lookup smart value.

Cheers,

Marini

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events