Add two values to Asset object through JIRA automation

Johannes Nyberg March 14, 2023

Hi, 

I´m trying to append X (object) to an objects  Custom Field in Assets. 
The automation works well when the field is empty. 

Then I add the Asset Field Value Location to the Asset Field Value Previous Location, like below:

AUTOMATION1.png

However, when the field is already containing a value, I would like to keep the previous value and append a value to the custom field. Like below:

AUTOMATION2.png

In general terms: 

IF A are empty
    A = X

Else
    A = A + X

end

This is however not working well on how Jira is updating objects. 
Can anyone provide guidance here? 

 

Thanks,

Johannes Nyberg

3 answers

0 votes
Darren Boyle March 20, 2024

This is what worked for me when I needed the same thing as the original post: How to Append Objects to an Assets Object Attribute using Automation | Jira | Atlassian Documentation

0 votes
Björn Gullander Eficode March 24, 2023

 

If you are editing an Asset custom field you should use the Edit issue action. The Edit object action is used for updating the attributes of an object in Assets. 

In that case you should use the values you have stored in the two different fields of the issues in an AQL query. 

A bit strange, but you should add the AQL in the Edit action to set the value: 

Something like this in the Edit issue action for Previous Location field


Key in ({{issue.Location}}, {{issue.Previous Locations}})
Johannes Nyberg March 26, 2023

Hi Björn! So I want to update two fields in the object. Not in an issue. 

For some reason it can only add one value and not two.. 

Best regards,

Johannes

0 votes
Bill Sheboy
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.
March 14, 2023

Hi @Johannes Nyberg 

What is the type of your field?  If it is text, have you tried using the concat() function:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#concat-String-str-

Kind regards,
Bill

Johannes Nyberg March 14, 2023

Hi Bill, Thanks for getting back to me. 

Both Location and Previous Locations are custom fields configured to contain other objects.

Location can only contain one object but Previous Locations has no limit.

Thank you,

Johannes Nyberg

Bill Sheboy
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.
March 14, 2023

Thanks for that information, and...FYI I am not using JSM so my suggestions are based on the documentation and what I know about automation rules.

Does the Edit Object action have an option with edit with JSON, does it have a ... menu to the right side of a field when you are editing it?  If so, there may be a way to add the option.  Otherwise you may need to call the REST API directly from the rule to add the option from another smart value.

Johannes Nyberg March 15, 2023

Hi, I only have the field below to work with. 

My guess is that it requires something between the two values. But all the symbols I´ve tried doesnt seem to work. 

Thank you, 
BILD_2023-03-15.png

Bill Sheboy
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.
March 15, 2023

In that case, you may want to contact Atlassian Support to learn if this is possible with a rule.  You appear to be the site admin for a paid license level, and so you can do that here: https://support.atlassian.com/contact/#/

Once you hear back from support, please post what you learn to benefit the rest of the community.  Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events