Forums

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

Subtask date custom field value update on main ticket custom field

Lakshmi CH
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.
October 18, 2022

Hi Team,

Can we map main task "Estimated completion date" to the last of the subtasks "estimated completion date's?

For example : 

 

It has to be the last, meaning we'd have to compare the dates, and determine which of them is the furthest away and then post that one. This will not be the 'latest' as in the most recently updated.
So posting the date that is the furthest out. Let's say a used updates date to "11/06/2022" but the other dates are "10/20/2022" and "11/11/2022"
The main task should read  "Estimated completion date" is "11/11/2022"

Thanks!

1 answer

0 votes
Sayed Bares _ServiceRocket_
Community Champion
October 18, 2022

Hi Lakshmi,

To achieve this with JMWE, you will need to use Set field value (JMWE app) post-function with the following code:

issue.get("subtasks")?.max{it -> it.customfield_10402}?.customfield_10402

You will need to replace  customfield_10402 with "Estimated completion date" ID, I hope it helps and let me know how it goes.

JMWE 1.png

Lakshmi CH
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.
October 19, 2022

Thank you for your quick reply @Sayed Bares _ServiceRocket_ . 

The main task is not reading the value. I have added this on create transition on subtask workflow, I have added the field on Main task view screen, but the values is not updating on the main ticket. In the post function, its showing the correct value.

 image_2022-10-19_104920044.png

 

This is main ticket :

image_2022-10-19_105617113.png

Sayed Bares _ServiceRocket_
Community Champion
October 21, 2022

If you are setting the Parent's Estimated Completion Date from the subtasks workflow then you will need to use Set field value of related issues (JMWE app) post-function with the following code:

issue.parentObject?.get("subtasks")?.max{it -> it.customfield_10402}?.customfield_10402

related issue.png 

Lakshmi CH
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.
October 24, 2022

@Sayed Bares _ServiceRocket_ ,

 Thank you for your quick assistance on this. I have added this post function on main issue type and Create transition, but the values of the main task is not changing with the furthest date. Am I doing any mistake here ?

date2.PNG

Sayed Bares _ServiceRocket_
Community Champion
October 25, 2022

@lakshmi 

If you are adding it in the main issue workflow then you need to use my first script:

issue.get("subtasks")?.max{it -> it.customfield_10402}?.customfield_10402

However, if you are using in the subtask workflow then use my second script:

issue.parentObject?.get("subtasks")?.max{it -> it.customfield_10402}?.customfield_10402
Lakshmi CH
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.
October 26, 2022

@Sayed Bares _ServiceRocket_  Is it on create transition ? its not working and not updating the main ticket with the value.

Sayed Bares _ServiceRocket_
Community Champion
October 26, 2022

@Lakshmi CH create transition of subtasks or main task? do you get any error when testing the code? can you share a screenshot from your setup?

Lakshmi CH
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.
October 27, 2022

Hi @Sayed Bares _ServiceRocket_ , Appreciate for your quick reply. I have added this code on main ticket create transition

issue.get("subtasks")?.max{it -> it.customfield_10402}?.customfield_10402

 Its showing the correct value when I testing in the workflow post function

main ticket create.PNG

But the right value (which is subtasks furthest away "Estimated Completion Date") is not updating on Main ticket

main ticket view.PNG

Sayed Bares _ServiceRocket_
Community Champion
October 27, 2022

@Lakshmi CH 

You are most welcome :)

Isn't that the expected behaviour? you wanted to set the main task with the furthest subtask "Estimated completion date"?

Lakshmi CH
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.
October 28, 2022

@Sayed Bares _ServiceRocket_ , The right value (which is subtasks furthest away "Estimated Completion Date") is not updating on Main ticket.

Suggest an answer

Log in or Sign up to answer