Automation to update custom label field based on two other custom label fields

Don Utley
Contributor
December 13, 2024

We've got a custom label field, "Fit /Gap Disposition", that is populated based off two other custom label fields, "Platform Fitness" & "Extensibility/Adaptability Fitness". The condition operator is "startsWith" because the values are like "5_90%_match" and "2_Customized to meet requirements"

  • IF "Platform Fitness" starts with 3, 4 or 5 AND "Extensibility...Fitness" starts with 3, 4 or 5 THEN "Fit/Gap Disposition" set to "Adopt"; 
  • IF "Platform Fitness" starts with 3, 4, or 5 AND "Extensibility...Fitness" starts with 1 or 2 THEN "Fit/Gap Disposition" set to "Argue"
  • IF "Platform Fitness" starts with 1 or 2 AND "Extensibility...Fitness" starts with 3, 4 or 5 THEN "Fit/Gap Disposition" set to "Adapt"
  • IF "Platform Fitness" starts with 1 or 2 AND "Extensibility...Fitness" starts with 1 or 2 THEN "Fit/Gap Disposition" set to "Avoid"

I'm trying to create an automation for whenever either two calculation fields are updated and both are populated, then run this calculation to set the Fit/Gap field. Below is screen shot and JSON for the rule as it currently is. I'm getting the error: 

 

 

No fields or field values to edit for issues (could be due to some field values not existing in a given project)

 

 

 

image.png

 

 

{ "conditions": { "and": [ 
{ "condition": { "field": "customfield_13900", "operator": "startsWith", "value": ["3", "4", "5"] } },
{ "condition": { "field": "customfield_13901", "operator": "startsWith", "value": ["3", "4", "5"] } } ] },
"actions": [ { "action": "set", "field": "customfield_13903", "value": "Adopt" } ] },

{ "conditions": { "and": [
{ "condition": { "field": "customfield_13900", "operator": "startsWith", "value": ["3", "4", "5"] } },
{ "condition": { "field": "customfield_13901", "operator": "startsWith", "value": ["1", "2"] } } ] },
"actions": [ { "action": "set", "field": "customfield_13903", "value": "Argue" } ] },

{ "conditions": { "and": [
{ "condition": { "field": "customfield_13900", "operator": "startsWith", "value": ["1", "2"] } },
{ "condition": { "field": "customfield_13901", "operator": "startsWith", "value": ["3", "4", "5"] } } ] },
"actions": [ { "action": "set", "field": "customfield_13903", "value": "Adapt" } ] },

{ "conditions": { "and": [
{ "condition": { "field": "customfield_13900", "operator": "startsWith", "value": ["1", "2"] } },
{ "condition": { "field": "customfield_13901", "operator": "startsWith", "value": ["1", "2"] } } ] },
"actions": [ { "action": "set", "field": "customfield_13903", "value": "Avoid" } ] }

 

1 answer

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.
December 13, 2024

Hi @Don Utley 

Would you please show an image of your rule's Edit Issue Fields action and of the audit log details showing the rule execution?

Until we see those...

I hypothesize you are trying to use that expression you show in the advanced edit with JSON, but it is neither valid JSON nor a valid conditional expression: https://confluence.atlassian.com/automation/jira-smart-values-conditional-logic-1081351607.html

Where did you find that syntax for performing a conditional check within JSON?

I recommend instead using the conditional logic and created variables to break this up into multiple parts, allowing easier rule maintenance and debugging using writes to the audit log.

Kind regards,
Bill

Don Utley
Contributor
December 16, 2024

Thanks, Bill. Below is the screenshot of the edit issue fields action. Its just the what-I-thought-was-JSON block above. 

I first tried to implement this rule a few months ago, but couldn't get it to work as stated above, so created an effector structure to do the job. That's not automated so trying to do that now. I don't remember if I grabbed that from another post when I was searching around or if I asked a LLM chat to write it for me. One of the two. I'll look at the page you linked.image.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.
December 16, 2024

Thanks, and I am fairly certain that syntax will not work with automation rules with JSON.

Instead you could use one of these:

  1. created variables and if / else conditions to set them, then use the variables to set the field value with JSON
  2. a single, long conditional expression with the or() and and() clauses to provide the value need
  3. four simpler conditional blocks which are mutually exclusive to create the JSON, where they match each of your four cases

The first approach will be easier to implement and test as the variables may be written to the audit log to check if the match what you expect.

Suggest an answer

Log in or Sign up to answer