Is there a way to change a default field based on a change in a custom field using Advanced Options?

Peter Yoon June 16, 2021

Scenario:
User changes `Functional Team` to `A`.
Automation changes `Team` to `A`.

I'm trying to figure out a way to reference a custom field in the Advanced Field Editing options.

This is what I've tried so far:

{
    "fields": {
        "customfield_12000": { "title": "{{customfield_11701.value}}" }
    }
}

Is there a way to change a default field based on a change in a custom field using Advanced Options?

Thank you!

Screen Shot 2021-06-16 at 12.47.08 PM.png

2 answers

1 accepted

0 votes
Answer accepted
Peter Yoon June 24, 2021

There is no way to update the "Teams" field that appears in Advanced Roadmaps by using Automation at this moment.

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

This page discusses Advanced Editing in the Automation feature, including referencing custom fields.

https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/

Peter Yoon June 16, 2021

Thank you for responding! That's the link I'm referencing. I couldn't find how to reference another field, hence my pseudo-code.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

First, I think the trigger for your rule is incorrect.

You scenario says "User changes 'Team' to 'A'" and then Automation changes field 'Functional Team'.

Your trigger needs to be When Value Changes for Team.

Second, what types of fields are this; single selection list, text fields, ...? 

Per the documentation, you can reference a custom field by its name or its ID:

Screen Shot 2021-06-16 at 1.38.41 PM.png

But the code to set field 'Functional Team' to match the value of field 'Team' may be different depending on the types of these two fields.

Like Peter Yoon likes this
Peter Yoon June 16, 2021

First, I think the trigger for your rule is incorrect.


The image is correct. My comment was incorrect. I edited my original post for accuracy. Thank you for pointing that out!

Second, what types of fields are this; single selection list, text fields, ...?

Functional Team: Select List (single choice)
Team: Team

Team is a locked default field from Jira.

Peter Yoon June 16, 2021

{
    "fields": {
        "Team": "Functional Team",
    }
}

^ Would this be the JSON object?
I'm still not sure what to add in the place of "Functional Team".

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.
June 16, 2021

Hi @Peter Yoon 

Adding on to what Trudy suggests, if you are unsure what the smart value of your field is, please use the technique described here to find it:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

Then try this for a single-select field, replacing your custom field numbers to match what you learn:

{
"fields": {
"customfield_1234" : { "value": "{{issue.customfield_4567}}" }
}
}

Best regards,

Bill 

Like # people like this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

Excellent, @Bill Sheboy ! I was trying to find the info on referencing the value of a custom field. You got to it faster than me! 

We don't use Team in our Jira instance so I can't say for sure how this would work.

From a response on the below post, it appears that the Team field can be set, but it seems like it needs to be set to the ID number for the team.

https://community.atlassian.com/t5/Advanced-Roadmaps-questions/Can-Automation-set-the-Team-field-when-an-issue-is-assigned/qaq-p/1616145

If that is the case, then you are going to have to find a way to determine which Team ID matches the name in the Functional Team field.

If it is actually possible to set the Team field directly from the Functional Team field value, then Bill's suggestion should work. You should be able to replace "customfield_1234" with "Team", and you would need to find the custom field ID number for your "Functional Team" field to use in place of "4567".

Like # people like this
Peter Yoon June 16, 2021

@Bill Sheboy Thank you for the reference. This is very helpful! Found the customfield IDs.

customfield_11701.title should change customfield_120000.value.
I'm running into "Error while parsing additional fields. Not valid JSON."

This is one of the solutions I've tried:
```
{
    "fields": {
        "customfield_12000.title": { “value”: “{{customfield_11701.value}}” }
    }
}

```

These are the customerfield IDs:
```
{
    "fields": {
        "customfield_12000": {
            "id": "9",
            "title": "ABC",
            "isShared": true
         },
        "customfield_11701": {
            "self": "https://<instance>/rest/api/2/customFieldOption/<some ID>",
            "value": "XYZ",
            "id": "12279"
        }
    }
}
```

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.
June 16, 2021

Peter, please try this one to just set the ID field and see if that helps.  Watch out for the quotation marks changing to curly/slanted type as the JSON won't like those.

{
    "fields": {
        "customfield_12000": { "id": "{{customfield_11701.id}}" }
    }
}

   

Like Peter Yoon likes this
Peter Yoon June 16, 2021

@Bill Sheboy Thank you. This seems to get us closer to what we need.

I'm receiving this error:

Error editing issues
TS-1 (The Team must be a string (customfield_12000))

Should the JSON object be:

{
"fields": {
"customfield_12000": { "title": "{{customfield_11701.value}}" }
}
}

 

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.
June 17, 2021

Hmmm...maybe?  With the smart value (field) updates, it isn't always clear what is needed. 

How about writing the smart value ...

{{customfield_11701.value}}

to the log in one action, and confirm it contains what you expect for the value as you try JSON for the edit in the other action?  That will help isolate what is working/not working.

Peter Yoon June 17, 2021

The smart value above works. But I'm still getting the same error. 

I reached out to Jira support to get more clarity on the issue. I'm hoping that it's a simple data input/syntax type issue that's easily solvable.

I'll keep y'all posted!

Thank you, @Bill Sheboy @Trudy Claspill, for all the help so far.

I hope that this thread can be a source for a solution later.

Like Bill Sheboy likes this
Jae Eddison
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 4, 2021

*

Pia Koivisto May 9, 2022

@Peter Yoonwere you able to find a solution for this issue?

Like Colin Tennery likes this

Suggest an answer

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

Atlassian Community Events