Jira automation set planned start dates for stories in epic

Felix Biegger March 23, 2023

Hi,
I am new to the whole automation thing, but want to give it a try.

Here's what I am trying to achieve:

* I have repetitive tasks / sample lots that are represented in an Epic

* stories are used for individual process steps. There are no further subtasks.

* I managed to auto-generate the stories for the epic. Now I would like to auto-set the planned start dates of the stories within the epic based on the planned start date of the parent epic.

* ie. story 1 starts along with the epic (I managed to do this, as there is a GUI option to do that)

* story 2 should start 5 business days after the epic planned start date --> I'll need to use a smart function/code for that

*story 3 should start 8 days after epic start and so forth... (I know the if function to distinguish between the stories btw. by checking if the name contains a specific wording)

* Like this I only need to create the epic and set it's planned starting date, while stories have that planned consistently, without having to input this manually every time.

 

I have no experience with coding at all, so please bear with me.

The trigger works fine as the first branch works OK, I just need to figure out the piece of code to look up the planned start date in the parent epic (=trigger issue) and put the adjusted date (likely with "plusBusinessDays(5)") in the story field.

grafik.pnggrafik.png

 

What actually would have helped a lot, would be if I could look at the code behind the things that you can choose within the GUI. E.g. in the screenshot below, I'd like to know what the fields are doing in code. I would have been able to copy/paste the lookup function for the trigger issue planned start date. Is there a way to check this code?

grafik.png

Thanks a lot in advance! cheers

Felix

1 answer

1 accepted

0 votes
Answer accepted
John Funk
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 23, 2023

Hi Felix - Welcome to the Atlassian Community!

Try using this for the Planned Start Date field in the Edit Issue:

{{issue.parent.Planned Start Date.plusBusinessDays(8)}}

It's case sensitive so be sure the field name is exactly the same. 

Felix Biegger March 23, 2023

Hi John. Thanks for the welcome and prompt reply!

Unfortunately, this didn't work. I used copy/paste and it just didn't do anything. Any suggestions?

I am wondering if there is a difference between parent and trigger issue, which should be the same in this case..

John Funk
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 23, 2023

What exactly did you try? And what exactly happened? Did the rule fire and didn't update the field? Did the rule fire and didn't meet the conditions? Check your audit log and post there here please. 

Felix Biegger March 23, 2023

Here's the input for the edit Issue:

grafik.pnggrafik.png

According to the rule audit log, it triggered correctly, chose the correct story out of the 5 available and edited the Planned start date. However, I can't see that change. (I guess I can kill the filter looking for stories. seems obsolete)

260 is the parent epic, 268-272 are the stories.

grafik.png

 

Resulting "input" in the planned start date field: none

grafik.png

John Funk
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 23, 2023

So what is the value for that field in the Epic (RDCELSA-260) now? And what is the value for that field in the Story (RDCELSA-269) now? 

Felix Biegger March 23, 2023

 RDCELSA-260 (parent epic): 04.04.2023 (changed from another random date to trigger the automation rule - which it did)

RDCELSA-269 (story): remains empty

John Funk
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 23, 2023

Okay, that's weird. Is the Planned Start Date field on the Create screen for the Story issue type? 

If so, the other thing to try would be to switch out the field name for the ID. So like this:

{{issue.parent.customfield_18951.plusBusinessDays(8)}}

Where 18951 is the ID for the Planned Start Date field. 

Go to Settings > Issues > Custom Fields and search for that field.

Click the 3 dots menu to the right and select Contexts and Default Value. Then look for the id in the URL address. 

Felix Biegger March 23, 2023

Is the Planned Start Date field on the Create screen for the Story issue type? --> Yes, the sceenshot above shows the edit window of the Story and the field is included when I add a new story

I looked up the number (10521), which is the same for both Story and parent epic and tried the code you posted. Unfortunately, exact same result. The log shows success in editing the issue, but the field remains empty.

 

What I find weird is that if I use the "copy from" function via the GUI without adding business days or the like, it works well. Also, "{{Now.PlusBusinessDays(5)}}" works as advertised. Therefore, the trigger and date-shift work as it should. It's just the editing of the cell that is buggy in combination with the lookup function

However it apparently works to lookup and copy/paste the unaltered date. Can we somehow look at the code behind this GUI controlled command so that I could copy it and add the date-shift?

grafik.png

Felix Biegger March 26, 2023

Any further tipps/recommendations regarding what I could try to get this done?

thanks

Felix Biegger April 3, 2023

@John Funkdo you have any other tipps for me? I am still trying to figure this one out without success.

Thanks!

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2023

Hi Felix - sorry for the delay, and thanks for pinging me again. 

Can you post the shot with the details of the code used for the Planned Start date getting it from the parent? 

Felix Biegger April 3, 2023

Thanks for getting back to my issue - no worries about the delay John. I hope I understood your request correctly.

 

I tried this:

{{issue.parent.customfield_10521.plusBusinessDays(5)}}

Results: log shows successful editing, but the field remains empty.

 

As mentioned above, commands like {{now.plusBusinessDays(5)}} or just {{now}} work and edit the correct field in the correct Story with the appropriate date (--> trigger and conditions work, as does the date shifting and editing of the field). For me this looks like the issue still is the lookup function.

Is it possible that it is a problem with how the date is displayed? I always have to input date in format DD/MMM/YY, but it is generally displayed as DD.MM.YYYY (standard european).

 

I tried to look at the code behind the GUI shown above (also works as advertised), but could not find something that I would identify as the lookup function. I guess this is hidden deeper within the code library.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 5, 2023

Okay, I think I see what is happening now. You are setting the date of the story at the same time you are creating it. I don't know what I though you were updating after the fact. So try this for the Planned Start Date field:

{{triggerIssue.Planned Start Date.plusBusinessDays(5)}}

You could also use the customfield_10521 if you like.

That should take care of it for you. 

Like Felix Biegger likes this
Felix Biegger April 5, 2023

@John FunkThanks a ton! That solved the issue for me and I was able to implement the automation rule!

 

I was in fact not setting the date while creating the story. I have one rule that generates the stories and then plan to edit the Epic with details incl. the planned start date. This will trigger the second automation rule setting the dates for the stories.

In any case, it seems that including "triggerIssue" instead of "issue.parent" was the crucial part.

thanks again

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 5, 2023

Yeah, I should have known better - didn't think that through from the beginning. Glad it is working for you!

Suggest an answer

Log in or Sign up to answer