Forums

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

Jira Automation - Add customfield date into a subtasks based on parent issue

Mateo Colombo February 7, 2023

Hi everyone,

I am trying to add a customfield ("Target start", of type date) to a subtask which should be calculated based on the Parent issue "Target start".

So...let's say:

Task A -> "Target start" = 24/04/2023  [ THIS IS THE INFORMATION I HAVE ALREADY ]

   Subtask a -> "Target start" = Task A "Target start" - 3 weeks  [ THIS IS WHAT I NEED ]

 

I created an automation as I have multiple Tasks and therefore multiple Subtasks that require this adjustments.

The automation runs smoothly but I am having trouble in parsing the Parent date into the subtask.

Captura de pantalla 2023-02-08 115603.png

EditIssue_Screenshot.png

I am not sure how should I complete the json part to complete this properly. Can someone suggest me other ways?

Thanks!

2 answers

0 votes
Patricia Francezi
Community Champion
February 7, 2023

Hi @Mateo Colombo 

When you need to do actions in different tasks, related, child and parents, you must use the Branch rules. 

So you will have options to do all the actions you need. 

As far as I understood you are not using branch yet 

You can find more information here https://support.atlassian.com/cloud-automation/docs/jira-automation-branches/

If you already using branch, as @Trudy Claspill mentioned, would be great having the screenshot for the whole rule, so we can help you. 
https://support.atlassian.com/cloud-automation/docs/jira-automation-branches/

Mateo Colombo February 8, 2023

Hi @Patricia Francezi !

I am using branches already, I guess. 

This is the error I get in the audit log about the parsing of the dates:

Captura de pantalla 2023-02-08 115756.png

0 votes
Trudy Claspill
Community Champion
February 7, 2023

Hello @Mateo Colombo 

Welcome to the Atlassian community!

Whenever requesting help with an Automation Rule, please show us the entire rule. Edit Issue actions and references to the issue object in smart values rely heavily on the context. Without seeing the entire rule we can't determine the context for this one action to offer you the proper advice.

Is you rule not working as you have written it? How exactly is it not meeting your expectations? What is shown in the rule's Audit Log when the rule executes?

Mateo Colombo February 8, 2023

Hi @Trudy Claspill 

Thanks for the reply! I already added everything.

Trudy Claspill
Community Champion
February 8, 2023

You should not have to use Advanced Editing for this.

Are you able to select the Target Start field directly from the available fields in the Edit action?

Screen Shot 2023-02-08 at 8.35.48 AM.png

 

Once you pick the field you can enter the smart value you want to use to set it.

Screen Shot 2023-02-08 at 8.37.46 AM.pngScreen Shot 2023-02-08 at 8.38.15 AM.png

 

I do wonder, though, why you are setting the target start date of a subtask to be 3 weeks before the target start date of its parent task.

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.
February 8, 2023

Hi @Trudy Claspill 

I believe Target Start, and some other advanced roadmap fields, cannot be selected from the Edit Issue dropdown list yet.  Instead only JSON edit works for them.  Here is the suggestion to fix that: https://jira.atlassian.com/browse/JIRAAUTOSERVER-159

Kind regards,
Bill

Like Trudy Claspill likes this
Mateo Colombo February 9, 2023

Hi @Bill Sheboy ,

Thanks you for your comment! I managed to get the json through with no errors BUT not entirely as I need it to.

I managed to pass to the subtask only the same date as the Parent (Task) with this json code:

{
"fields": {
"Target start":"{{triggerIssue.Target start}}"
}
}

Now, what I really need is to add or subtract dates to the target start date of the Parent.

When I try to do so:

{
"fields": {
"Target start":"{{triggerIssue.Target start.plusDays(21)}}"
}
}

 

I get the following error:

Edit issue
Error editing issues
Ticket-ABC (Unparseable date: "" (customfield_11800))

 

Do you have any suggestion on how to do so?

Mateo Colombo February 9, 2023

I finally manage to do it!

I had to convert the date into a date type using toDate (which apparently was the error) and then add the days:

{
    "fields": {
        "Target start":"{{triggerIssue.Target start.toDate.minusDays(21)}}"
    }
}

Now I am getting the results expected!

Thanks everyone for the help!

Like # people like this

Suggest an answer

Log in or Sign up to answer