How to implement the lookupIssues function for the due date field in Jira Data Center

vincenzo_spatafora
Contributor
April 30, 2024

Dear ALL,

is there a way to implement in the Jira Data Center (I use version 9.12.5) the powerful Jira Cloud feature of the lookupIssues on the due date field?

Thanks in advance,

Vincenzo.

1 answer

1 accepted

2 votes
Answer accepted
Kalyan Sattaluri
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.
April 30, 2024

Hello @vincenzo_spatafora 

What do you mean implement lookupIssues on Due Date field, as in access Due date field in the response of lookupIssues JQL?

 

 

vincenzo_spatafora
Contributor
April 30, 2024

Thank You @Kalyan Sattaluri for your reply.

Yes, correct and my JQL in the Lookup issues is "issue in childIssuesOf("{{issue.key}}")".

And afterwards, in log action, my log message is "List of Sub-Tasks is {{lookupIssues.key}} and the Due Date is {{lookupIssues.duedate}}".

From the Audit log, the list of the sub-tasks is nicely reported but NOT the due date.

Do you see a reason for that?

Thanks in advance,

Vincenzo.

 

 

Kalyan Sattaluri
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.
April 30, 2024

Unfortunately, in Data Center, lookupIssues exposes only certain (basic) fields and we dont have option to expand that list.

 

It needs to be an update from Jira itself where they are expanding available fields like it is in Cloud, where all fields are accessible.

But, looking at your post, if all you want is to access sub-task fields, you dont need to do lookupIssues.

You should be able to reference it as {{issue.subtasks.key}} &  {{issue.subtasks.Due date}}

Please try and let me know if issues..

vincenzo_spatafora
Contributor
April 30, 2024

Thanks @Kalyan Sattaluri , appreciated your help.

I was trying that: the trigger of my rule is an issue transition: how can I pick all the associated sub-tasks?

And also, I need to take the max due date of all the sub-tasks tickets.

What would be the syntax in this case?

Kind Regards, Vincenzo. 

Kalyan Sattaluri
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.
April 30, 2024

You reference it as I mentioned.. see screenshot below..

{{issue.subtasks.Due date}}  <- gives you list of dates

{{issue.subtasks.Due date.max}} <- gives you max date

Please try to log above values like I have in my screenshot to verify you are seeing the correct values and do your next steps..

 

image.png

Like Bill Sheboy likes this
vincenzo_spatafora
Contributor
April 30, 2024

Thank You @Kalyan Sattaluri , we are almost there.

Yes, I see in the log what I expect.

Just the very last action is NOT performed: what I need now is that the issue wich has triggered the rule gets, from this rule, its Due Date updated to the max due date of its sub-task.

See please my rule flow:

sub-task_duedate_max.PNG

Where the Edit issue fields is:

 

DueDate_Edit.PNG

 

Kalyan Sattaluri
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.
April 30, 2024

No need to do branch, just directly edit issue like below..

If it works, please accept answer so it benefits otehrs in the future.

Thanks!

image.png

Like Guido Scollo likes this
vincenzo_spatafora
Contributor
April 30, 2024

Thanks again @Kalyan Sattaluri but there is something wrong with the very last step (the Edit).

See please the Dates of the triggering issue either at Feedback status and after the transition (to In Progress); as you can see the Due Date, after the transition / and so the Edit, has even disappeared:

Feedback.PNG

Progress.PNG

Kalyan Sattaluri
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.
April 30, 2024

Hello @vincenzo_spatafora 

What is happening is your smart value {{issue.subtasks.duedate.max}} is resolving to null and so your field is getting wiped out.

Have your confirmed the out put of {{issue.subtasks.duedate.max}} by logging it? Can you share screenshot?

Last time I came across such an issue helping, the poster has 2 due date fields configured.

So, instead of referencing it as {{issue.subtasks.duedate.max}} , you need to reference it by its customfield value.. {{issue.subtasks.customfield_xxx.max}} 

So, first log the {{issue.subtasks.duedate.max}} value and second, see if you have another field with the same name which is null..if so, find the customfield for the one you need to use.

vincenzo_spatafora
Contributor
May 2, 2024

Hi @Kalyan Sattaluri, sorry to reply only now but yesterday here it was holiday.

Find please attached the log action.

Where can I find the relevant custom field number? But is not the due date a System field? 

I would like also to ask: in case there are 4 sub-tasks and I need to take the due date of the 3rd sub-task, what would it be the syntax to apply?

Thanks in advance for your help.

Kind Regards, Vincenzo.

vincenzo_spatafora
Contributor
May 2, 2024

LogAction.PNG

Kalyan Sattaluri
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.
May 2, 2024

Find an issue where this due date field is already populated. For example ABC-1234.

Then in below URL, replace bolded parts, copy the URL, open new tab in browser, paste the URL and hit enter

https://yourdomain.net/rest/api/2/issue/ABC-123?expand=names

Then you should see JSON response. In the response, find the due date value you entered earlier. (ex - 2024-05-31)

When you find this value, see which field is it assigned to.

If it says custom field.. we need to use that field to edit your issue using advanced edit.

Please follow above steps and share screenshot of relevant section of your JSON.

vincenzo_spatafora
Contributor
May 3, 2024

Hi @Kalyan Sattaluri,

thank you: it has worked.

Thanks a lot for your great help.

Kind Regards,

Vincenzo. 

Kalyan Sattaluri
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.
May 3, 2024

@vincenzo_spatafora Great to hear. Can you share what was the issue and solution..

Also, Please consider accepting answer so it benefits others in the future, thanks!

vincenzo_spatafora
Contributor
May 3, 2024

Hi @Kalyan Sattaluri,

as you were alluding, there were 2 due date fields being configured.

I have already accepted the answer.

Thanks again,

Vincenzo. 

Like Kalyan Sattaluri likes this
Kalyan Sattaluri
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.
May 3, 2024

Awesome. BTW, I dont see answer as accepted. You have to do that to the first post. :p Thanks and have great day.

vincenzo_spatafora
Contributor
May 3, 2024

Do you see it now?

Like Kalyan Sattaluri likes this
Kalyan Sattaluri
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.
May 3, 2024

Yes, lol, Thanks!

vincenzo_spatafora
Contributor
May 3, 2024

Forgot to mention that in your above URL, jira was missing, so for me is working like this:

https://yourdomain.net/jira/rest/api/2/issue/ABC-123?expand=names

Suggest an answer

Log in or Sign up to answer