jira automation for team managed project when story changes parent

Ryan
Contributor
March 12, 2023

i'm trying to trigger the event when story changes parent in a team managed project

 

so far from what i know, the thing is bugged so you need to use 'issue updated' but when i tried to access the changelog, i can't seem to find the field i'm supposed to use to access the current and previous parent

so the smart value i was trying to use was

{{#changelog.parent}}{{fromString}} {{/}}

{{#changelog.parent}}{{toString}} {{/}}

both are blank even though i can see it in the story changelog that a parent field was updated

 

2 answers

1 accepted

6 votes
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.
March 12, 2023

Hi @Ryan 

Short answer: you can access the id of the previous Epic and use that to get more information.

Longer answer:

Changelog has a few challenges with the parent field (and list fields).  The REST API seems to indicate this field is supported for Team-Managed Projects, but as you show it can only be read as a field/smart value...not detected as a change.

After checking the complete change history for an issue with the REST API, I found there is another smart value that shows the change of parent: IssueParentAssociation.  That provides the issue id rather than the key.

An example rule to use that would be:

  • trigger: issue updated
  • advanced compare condition:
    • first value: {{#changelog.IssueParentAssociation}}{{fromString}}{{/}}
    • condition: does not equal
    • second value: {{#changelog.IssueParentAssociation}}{{toString}}{{/}}
  • branch: on JQL with id = {{#changelog.IssueParentAssociation}}{{fromString}}{{/}}
    • action: log that the prior epic was {{issue.key}}

 

Kind regards,
Bill

Ryan
Contributor
March 12, 2023

thanks, that worked!image (9).png

example.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.
March 13, 2023

I am glad that worked for you, and...something I note in your rule:

The rule appears to use two JQL branches on the previous and current parent, and then edits each specific issue's Pivots field.

Branches that could be on more than one thing (e.g., JQL) run asynchronously and in parallel.  There is no guarantee when the processing of the branch will finish, up to the last step of the rule.

If that image is your entire rule, no problem!  However, if your rule has more logic after those branches AND which depends on the edits being completed, the rule may not work as you expect.

Ryan
Contributor
March 13, 2023

ah ok, that's good to know on how jql handles asyncrhnous. yea it's fine in this case, cause the order isn't as important. i'm trying to build my own logging of pivots that occurred in the lifetime of the epic by logging that info back to it's previous and new parent

Like Bill Sheboy likes this
0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 12, 2023

Hi @Ryan 

I think that you need to create a text CF and copy the parent key to that field when a new subtask is created. And update/compare this value with the issue update trigger. I can confirm that {{#changelog.parent}}{{fromString}} {{/}} returns empty, whereas {{issue.parent.key}} yields the proper key.

Ryan
Contributor
March 12, 2023

that only gives me the new parent and not the old parent though. i need both the new and old parent 

Suggest an answer

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

Atlassian Community Events