Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Update Custom Date field with Due Date from Linked Issue

Edited

Hi,

Is it possible to use a listener to update a Custom Date Field with the Due Date, but the Due Date information is on a ticket that relates to the main ticket?

Example:

- IssueA has the custom date field

- IssueB is linked to IssueA (relates to) and IssueB has the Due Date field filled in

- Want to automatically copy the date in the Due Date field from IssueB to the custom date field present in IssueA

 

Would that work with regards to the linking/relates to aspect?

 

I have this script which I used previously to update a date field but unsure how to modify the script to full the "Due Date" from the linked/relates to issue.

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.link.IssueLink;

def issue = event.issue

def issueLink = ComponentAccessor.getIssueLinkManager()

 

// the name of the custom field to update
final customFieldName = 'FieldA'

// the new value of the field
final newValue = linkedissue.dueDate //This is where I am struggling

def customFieldManager = ComponentAccessor.customFieldManager

def customField = customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName)
assert customField : "Could not find custom field with name $customFieldName"

customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), newValue), new DefaultIssueChangeHolder())

 

Thanks.

2 answers

1 vote
Julien Peyrade _ Elements
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Sep 06, 2022

Hello @Drishti Maharaj 

If you don't mind testing an add-on, Elements Copy & Sync lets you do exactly that.

Full disclosure, I'm the Product Manager of the app.

With our fields mapping, you can copy anything you want from an issue to another issue, including a Date Custom Field into the Due date.  

As a bonus, you can keep this value synchronized, so if you change it in the original issue it can change automatically in the copied issue.

The app is free for 30 days, (and stays free if your instance is under 10 users), so feel free to give it a try, and don't hesitate to tell reach our Support if you have any question.

Kind regards,

Julien

Shouldn't automation be able to handle this?

Hi, I assume I can have the trigger where the issue is created/update and then "edit issue" to update the custom date field. However, I am a bit unsure how to get the value of the Due Date from the linked issue itself?

Can you describe in detail how it should work?

Issue A has the custom field

Issue B has the Due Date

When would you like to copy this? When the Due Date is entered in B, the value will be moved to A?

So going forward yes, when the Due Date is entered in B, it should be copied over to the field in A.

However, we have about 100 issues already that need to be updated first.

B already has the Due Date field filled in and want to copy that info across to the custom field in A so was trying to find a way to do this automatically for the existing issues first.

For the old issues - you can either create a script that would iterate through them,  copy this manually or add it in the CSV - download the one with the field with the date and upload - but you would need issue keys

I can check this script, just let me know what's wrong 

Thanks @Lukasz Grobelny , this is what I get -  the error is on line 15 - not too familiar on how to manipulate the script to cater for the linked issues itself?

1.png

Will try to check this tomorrow if that's ok with you :) 

Perfect. Appreciate the help @Lukasz Grobelny 

It is created at the timing when the custom field is needed, such as when the WBS or Gantt chart screen is displayed for the first time or when the setting screen is displayed.

Even if these custom fields are deleted, they will be created again when WBS Gantt-Chart for Jira needs that custom field.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events