copy date between 2 custom fields

Debraj Neogi November 28, 2016

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

0 votes
Vasiliy Zverev
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.
November 28, 2016

Try this code:

import com.atlassian.jira.component.ComponentAccessor


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

Debraj Neogi November 29, 2016

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

Vasiliy Zverev
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.
November 29, 2016

This is for scriptRunner custom script postfunction.

swetha meti November 29, 2016

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?

 

Vasiliy Zverev
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.
November 29, 2016

Since you need a listener on issue Update event.

swetha meti November 29, 2016

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
TAGS
AUG Leaders

Atlassian Community Events