copy date between 2 custom fields

We have two date (custom) fields. Requirement is when one edits field A, field B needs to be refreshed with A's data (date). Is there some script we can try and use?

Thanks.

1 answer

Try this code:

import com.atlassian.jira.component.ComponentAccessor


issue.setCustomFieldValue(
ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("dateTo")
, issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("dateFrom"))
)

Thanks for the response. Should this be added in Behaviors, or Script Runner? Can you please provide a little more detail.

This is for scriptRunner custom script postfunction.

We have already implemented a postfuntion . But we need the value to be copied from Field A to Field B incase of any changes to Field A's value and not to depend on Status Change.Can you suggest some method to implement this in detail?

 

Since you need a listener on issue Update event.

can you please explain me the steps that needs to be followed for creating a listener on issue Update event for Field A changes, so that Field B is updated?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published 4 hours ago in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

26 views 0 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you