Jira Automation: How to update Epic with parent Initative information
Asked by Guy Slade:

Hi ... I am completely new to Jira automation,

I would like to be able to set my Epic Team attribute with the Team attribute of its parent Initiative. I have successfully done this with a Story.... when the Story's Epic Link is changed I update the Story's Team attribute with the value from its parent Epic. I achieve this with the following JQL:

{ "fields": { "customfield_11600": "{{issue.epic link.customfield_11600.id}}" } }

The Team attribute is a custom field and I discovered it's name through 'inspecting' the Story and Epic via Firefox.

I know that the custom field in the Initiative has the same name (customfield_11600) by again using inspect

My JQL for updating the Epic when it's Parent Link is updated is:

{ "fields": { "customfield_11600": "{{issue.parent link.customfield_11600.id}}" } }  

When I update the Parent Link of my Epic, the Team attribute of my Epic is not updated. When I look at the log I can see that my 'issue condition' was triggered successfully and that my 'issue edited' was also successful and in both cases it is listing my Epic triggering the condition and being edited.

I started playing with writing out to the audit log and things got weird for me. Looking at my successful Story update automation, I made the following two log entries:

Parent is: {{issue.epic link}}

Parent Team is: {{issue.epic link.customfield_11600.id}}

Both produced what I was expecting... it listed the Epic id and it listed the id of the Epic Team that was then successfully set in the Story. ..... so far so good.

I then tried the same for the Epic automation

Parent is: {{issue.parent link}}

Parent is: {{issue.parent link.customfield_11600.id}}

This successfully lists the parent Imitative id but absolutely nothing for the Team id. I repeated with exercise to log out the Summary. It worked for the story again and gave me nothing for the Initiative.

I don't understand what is going on! ... HELP! :-)


Answers:
author: Bill Sheboy
body: Hi [@Guy Slade](/t5/user/viewprofilepage/user-id/5537873) -- Welcome to the Atlassian Community!

*First thing, I am using Jira Cloud, not Jira Data Center. And so my suggestions are based on what I know about automation rules, in general. With that out of the way...*

Context is important for automation rule questions. Please post an image of your complete automation rule, images of any relevant actions / conditions / branches, and an image of the audit log details showing the rule execution. Those will provide context for the community to offer ideas.  

Until we see those...

For smart values such as parent, Parent link, Epic Link, subtasks, and issuelinks, they connect the current issue to some other issue(s). But, *they do not load all of the data for those connected issues*. If they did, one could imagine a scenario where a rule accessing a single issue would try to pull in many others!

Some of those smart values provide more data about the connected issue than others. What I hypothesize is happening is *Epic Link* pulls in your custom field for Team but *Parent link* does not...as your write to the audit log confirms.

As you want to update the Epic with data from the Initiative, this would be easy if the Lookup Issues action supported custom fields: just use JQL to load the Initiative and copy the field from there. But, that does not work in Data Center yet: <https://jira.atlassian.com/browse/JIRAAUTOSERVER-877>

The only workaround I know of is to instead use the Send Web Request action to call the REST API for get issue or search issue with JQL. Then the custom field could be used from the web response message. If you want to try that, here are a how-to article and REST API reference:

* <https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828>
* <https://docs.atlassian.com/software/jira/docs/api/REST/9.13.0/#api/2/issue-getIssue>

Kind regards,  
Bill

comments: author: Guy Slade
body: Hi Bill,

First off, thank you for your prompt response! I appreciate the help here. While I start reading through the links you have provided above and see if I can figure out how to go the suggested Web Request action route, here are a few screen shots of the Story and Epic rules and the log results for each. Looks like it confirms what you think is happening


author: Guy Slade
body: ![Screenshot 2024-07-08 at 11.00.09?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/334052iBFDDA77C9228DCEA/image-size/large?v=v2&px=999 "Screenshot 2024-07-08 at 11.00.09?AM.png")![Screenshot 2024-07-08 at 10.58.48?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/334053iEDF62B601864312A/image-size/large?v=v2&px=999 "Screenshot 2024-07-08 at 10.58.48?AM.png")![Screenshot 2024-07-08 at 10.59.54?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/334054i69AC60278531BC24/image-size/large?v=v2&px=999 "Screenshot 2024-07-08 at 10.59.54?AM.png")![Screenshot 2024-07-08 at 10.59.39?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/334055iB627DD233C3CE6D0/image-size/large?v=v2&px=999 "Screenshot 2024-07-08 at 10.59.39?AM.png")


author: Bill Sheboy
body: Thanks for the rule and log images to confirm the scenario. It appears you will need the REST API method to do this.

**Before you proceed**, I recommend trying this to confirm the field is available:

* using an example Initiative such as FS-7, call the REST API *get issue* endpoint by entering this URL in a browser tab

```
yourJiraURL/rest/api/2/issue/FS-7
```

* Search on the page for the custom field 11600 for your Teams field
  * If you find it and it has a value, the method I suggested earlier will work
  * If you do not find it, or it has no value, the Team field may not be supported for this approach


author: Guy Slade
body: Bill, quick FYI ..... I managed to get it working using your webhook suggestion. Thank you again for the helping hand! I have learned a lot from this exercise.


author: Bill Sheboy
body: Awesome; I am glad to learn that helped!


Tags: data-center

jira-data-center