Hello everyone,
I have a custom field - Select List (multiple choices) and from this custom field I want to fill in an Assets objects custom field which can hold multiple objects. With automations, I was only able to edit the field and add one value - with advanced branching for each value, it simply overwrites the previous one so in the end I always have a single value in the field. Any ideas on how I can maybe attend a value instead of setting it?
I am not sure what your query to the Asset database is, but my guess is that it returns single object everytime? If so, is it maybe possible to use just one Lookup with combined query to search for all objects altogether? I can help you with that, but I will need a little bit more info about the original multiple select and how do you translate those values selected to assets query.
If so, then you can really shorten this automation to two actions:
Once you get the Lookup Objects to return all objects you need, you can then simply use "Edit issue" action, select field you want to edit, and put this inside:
Key IN ({{#lookupObjects}}"{{.}}"{{^last}}, {{/}}{{/}})
This will ensure all returned objects are stored in your multi picker assets field.
Have a nice day!
Hello František,
that'd be fantastic - the select field holds the labels of the objects. I couldn't think of a way to look up all values from the select list at the same time. Could you advise how I could do that?
Best Regards,
Luka Urushadze
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
could you please provide us any example? What does the values in the multi select look like and what does a single object in your databse look like, so I can help you with the query?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! Here's the values of the select field as an example, and one of the assets. It's a list of countries actually.
Field values:
Asset Object:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that should be fairly easy - I see that you can search by label for assets, so I would do something like this (for having it well aranged and debugable for the future).
After trigger will follow these actions:
{{#issue.Field}}"{{.}}"{{^last}},{{/}}{{/}}
label IN ({{countries}})
Key IN ({{#lookupObjects}}"{{.}}"{{^last}}, {{/}}{{/}})
And this is it.
Obviously "Log action" steps are optional, but I always recommend printing at least some variable from within the automation to the audit log. In case it fails somewhere from time to time, it will be much easier for you to see what happened. E.g. you will add new option to the select, but forget to add new value to the assets too. That might result in lookupObjects being empty.
Also one last note: I am not sure what your process is, but why won't you let people use that asset field directly? Thats probably the biggest advantage of the whole assets - to be able to select from them. Even on the customer portal or anywhere. Here you are basically just duplicating things.
Have a nice day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi František,
thanks a lot, that saved my day! It worked perfectly and was exactly what I was looking for.
I couldn't use the asset fields directly as the flow usually starts from people importing large number of issues via CSV, with large number of assets in the list, so we needed it to be automated.
Huge thanks and have a nice day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it was pleasure to help you. If you can, please accept my answer as an "Accepted answer". thanks to that, this answer will stay on the top and your question will be labeled as answered.
Thanks and have a nice day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The object that is linked with the asset custom field, what is the cardinality set for the attribute.
By default this is 1, you might need to change that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc, thanks for the answer! The custom field can hold multiple values when I add them manually, is that still relevant?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, then your cardinality of the custom field of type assets is correct
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luka,
I imagine you'd probably have to get creative and use JSON in conjunction with smart values to update this, similar to what's illustrated in solution 2 in this article. https://support.atlassian.com/automation/kb/how-to-update-a-select-field-multiple-from-the-content-of-other-fields/
Have you attempted that yet?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/ this might contain some more useful information too
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.