Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Project Properties with smart values in automation to edit "additional fields"

Walter Lamm
Contributor
May 8, 2024

Hi community,

I'm creating issues in many different automation rules and right now have to let them copy a select few fields every time from their parent. 

For example if an issue is created under an epic through an automation I have to copy the associated customer and their adress and some additional fields from the parent. In another if-branch I have to repeat this step for another create action and do this in any other rule that creates an issue. Errors by forgetting some fields or adressing the wrong source are almost inevitable.

My solution to this problem was to define these fields as a project property like this:

prop.png

So the fields with basic infos are defined on the left and the source from which they should be populated (parent) on the right.

In my rule I wouldn't have to select every field seperately but just input "{{project.properties.parent_basic_infos_property}}" in the additional fields section under the edit issue field action.

But when I do that i get this error message: "Error while parsing additional fields. Not valid JSON."

A log action with the property smart value just gives me exactly what you see in my screenshot. The parent smart values stay as is without retrieving their values. 

What's not valid in this JSON object?


I had the same problem in another rule in which I collected some fields in an issue property "summary_entities" on an epic so their child issues could be populated with these fields through this issue property on the epic when one field changes so they would always have these fields synchronized to their parent. When inserting this property in the additional fields of the edit action for the child issues I got the same error.

I solved this problem by wrapping the JSON with extra characters "*+" at the beginning and "+*" at the end:

sommary prop.png

I then inserted this into the additional fields of the edit action: 

{{issue.parent.properties.summary_entities.substringBetween("*+","+*")}}

Somehow the rule no longer had any problem with the vailidity of the JSON.

Does anyone know why?


Sadly this workaround doesn't work in this case because I'm defininig the fields on a project property so it only contains the smart values and not the actual infos I want to copy. It should populate these infos before editing an issue through the additional fields.

In my workaround I already populated the infos during the creation of the issue property and just had to copy the JSON object.

 

As you can imagine I don't quite understand what the problem might be. Any help would be highly appreciated because it would fix a big problem I continuously have.

 

Thanks for reading that big block of text!

2 answers

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.
May 8, 2024

Hi @Walter Lamm 

If I am following your scenario, you are trying to create just-in-time, dynamically executed JSON, not just dynamically defined JSON.

The distinction I am making is:

  • dynamically defined: build dynamic JSON, looking up any values at the time the JSON is created, creating a static text string
  • dynamically executed: build dynamic JSON, deferring the lookup of values until later when JSON execution is attempted, such as within a branch with issue actions

If that was possible, self-modifying rule behavior would be possible!  Which it is not at this time, in my experience.  (If they ever make a public REST API for rules, no doubt self-modifying rules will be created.)

 

Without seeing your complete rule, I hypothesize a few possible workarounds are:

  • review your original rule structure to learn if the use of the entity properties can be eliminated with rule conditional logic, branching, and re-fetch issue actions
  • use multiple rules, perhaps chained, in order to update / refresh those "source" fields in newly created issues

 

Kind regards,
Bill

0 votes
Walter Lamm
Contributor
May 8, 2024

@Bill Sheboy Hey, maybe you could chime in? I very much value your expert knowledge all things automation. Thank you!

Suggest an answer

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

Atlassian Community Events