Forums

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

How can I pull "Team" from Jira Plan into the Issue Collector / Automation

Isabella Musial
Contributor
August 29, 2023

I am trying to add the team name to a jira issue via automation since the field is not available in the Issue Collector. 

 

I have tried adding this to the automation rule, but this did not work. I am sure it's not difficult, I hope, but I cannot figure it out. Thanks in advance for your help. 

{
"fields": {
"Team": "1080",
}
}

Capture.PNG

1 answer

1 accepted

1 vote
Answer accepted
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.
August 29, 2023

Hi @Isabella Musial 

As Jira has several things named "Team" I recommend using the custom field id in that JSON expression.

You may find the correct value using the how-to article linked below.  Essentially you identify an example issue with your field, call a REST API function to see all supported fields, and then search on the page to find your field's smart value and custom field id.

https://confluence.atlassian.com/automation/find-the-smart-value-for-a-field-993924665.html

Kind regards,
Bill

Isabella Musial
Contributor
August 30, 2023

@Bill Sheboy  Thank you for responding. I tried using the following JSON but not sure I wrote it down correctly as it's not working. I get a failed message each time. The following fields should be filled out (below) in addition to the Team field.  I have tried using the team id as well as the team name. Still not working. Would love the help! 

{
"fields": {
customfield_10101: "1080",
}
}

 

{
"fields": {
customfield_10101: "DTO - Systems Engineering",
}
}

 

 

TechDebtAutomation1.PNG

Isabella Musial
Contributor
August 30, 2023

I am also trying update / set and it's no working.  For example:

{
"update": {
"customfield_10101": [{
"set": "DTO - Systems Engineering"
}],
}
}

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.
August 30, 2023

I think the error could be caused by one of two things: a trailing comma or the incorrect syntax.  Please try one of these:

{
"fields": {
"customfield_10101": "1080"
}
}

Or...

{
"fields": {
"customfield_10101": { "id" : 1080 }
}
}
Isabella Musial
Contributor
August 30, 2023

@Bill Sheboy  Thank you... I really appreciate your help troubleshooting!

Unfortunately that didn't work either. I copied directly from your response. 

I've tried using the customfield_10101, "Team" as well as "1080" and the actual team name. No luck. 

I have faith in Jira that I can do this, but I am not a JSON expert by any means.

 

Should I put the JSON in its own "Edit Issue" component so it's standalone? I found that if I add too many fields into the component, then they don't update the jira issue.

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.
August 30, 2023

Hmmm...I wonder if there is a different issue related to your rule structure.

Would you please post an image of your entire rule, and include an image of the edit issue action?

Isabella Musial
Contributor
August 30, 2023

Capture.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.
August 30, 2023

Yes, that helps; thanks!

When you edit an issue in a rule, particularly the trigger issue, it is using the current conditions at the time the rule was triggered.  If you want to include the latest edits, each edit must be followed by the Re-fetch Issue action to reload the information before the rule proceeds.

Because each call to Re-fetch Issue can add about one second to run time, it helps to consolidate your edits to one action, when possible.  Let's try that first.

If you have multiple edits requiring JSON, let's look at how to merge those into one action also.

Like Isabella Musial likes this
Isabella Musial
Contributor
August 30, 2023

I tried to have Label, Classification, FixVersion, Epic Link and the JSON in one component, but when I created the issue via Issue Collector, everything but the Epic Link was missing. That's why I split it out. I had 2 fields in a component and that worked. 

Like Bill Sheboy likes this
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.
August 30, 2023

That is curious...I wonder how that manifests in the rule execution differently for ones created by Issue Collector.

There is a known behavior that the Issue Created trigger can occur so quickly that other data is not available for the rule to use it.  And, subsequently your edits could be "walking over" each other and other saved data!

The work-around for that is to *always* put a Re-fetch Issue action immediately after the Issue Created trigger.  Perhaps try that, and then merge all of your edits to one action and observe the results.

Like Isabella Musial likes this
Isabella Musial
Contributor
August 30, 2023

How do you do a Re-Fetch?

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.
August 30, 2023
Like Isabella Musial likes this
Isabella Musial
Contributor
August 30, 2023

Thank you. I added that just before I send the email. Is that the correct placement? 

Isabella Musial
Contributor
August 30, 2023

Ok, that worked. 

Still open issue about that silly Team field! 

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.
August 30, 2023

Would you please post an image of your current, complete rule...including details of the action to set the team?  Thanks!

Like Isabella Musial likes this
Isabella Musial
Contributor
August 30, 2023

automation3.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.
August 30, 2023

You are missing 2 calls to Re-fetch Issue...

Add one immediately after the trigger, and before the condition test

Add another after the first edit issue action.

So the rule will look like this:

  • trigger...
  • action: Re-fetch issue
  • condition...
  • action: edit issue for Epic Link, Fix Versions, Labels, and Classification
  • action: Re-fetch issue
  • action: advanced edit for the Team field
  • action: Re-fetch issue
  • action send email
Like Isabella Musial likes this
Isabella Musial
Contributor
August 30, 2023

automation4.PNG

Isabella Musial
Contributor
August 30, 2023

So like this? ^^

but what about the Team field? Its crazy that it's not there when it's out of the box on Advanced Plan - is that because it's a 3rd party or a plugin? 

Isabella Musial
Contributor
August 30, 2023

FYI - Re-Fetch worked and all fields populated.

Like Bill Sheboy likes this
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.
August 30, 2023

My understanding is many of the fields in Advanced Roadmaps are not supported by APIs that automation rules use.

I am glad to learn you have all the fields working now.  Do you consider this one solved?

Isabella Musial
Contributor
August 30, 2023

still cannot populate my team field, which was my original question. :( 

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.
August 30, 2023

Thanks for clarifying.  When you used that how-to article to find your field's smart value, did you find it?

That is, for your example issue you tried did you see a smart value and custom field id for it?

Isabella Musial
Contributor
August 31, 2023

Honestly, I couldn't figure out what I was supposed to use or how to write the JSON. 

Looking here: 
Jira smart values - issues | Automation for Jira Data Center and Server 9.0 | Atlassian Documentation

Would I use the issue.CustomField.10101 or issue.CustomField.team?  

{{issue.CustomField.id}}

Should the JSON in the component read: 

{
"field": {
"{{issue.customfield.10101": "DTO - Systems Engineering"},
}

 

Again, thank you so much for your help! I really appreciate it. I would rather use this than the Confi forms since it's less confusing.  Well, except this part! 

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.
August 31, 2023

Once the rule is editing a field with JSON, you only reference the field name.  Please try this:

{
"fields": {
"customfield_10101" : "1080"
}
}

You noted the value "1080" earlier, so if I have that incorrectly noted, please replace it. 

Like Isabella Musial likes this
Isabella Musial
Contributor
August 31, 2023

FINALLY!!! that worked! OMG thank you thank  you thank you! 

Isabella Musial
Contributor
August 31, 2023

I swear I tried that before, but wonder if the Re-Fetch helped? Anyway, I am very happy it worked. Thank you so very much for all your patience! 

Like Bill Sheboy likes this
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.
August 31, 2023

Nope, looks like my mistake as I left off the quotation marks around the field name on the left-side of the JSON.  (I will update that earlier post.)  Sorry about that, and I am glad to learn it is working now.

If it is all working, please consider marking this one as "answered" so others can find solutions to related needs.  Thanks!

Like Isabella Musial likes this
Isabella Musial
Contributor
August 31, 2023

Done! Thank you again, I really appreciate it.

Suggest an answer

Log in or Sign up to answer