Forums

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

Can I update a custom field (type date) during workflow transition ?

Manuel Campomanes
Contributor
January 24, 2012

Hello,

I need to update a date field (deliveryDate) with a specific value during a workflow transition.

Example : deliveryDate = createDate + 14days

-----

I think I need to instal a Jira Plugin, I take a look about "Jira suite utilities" but I don't try it yet.

2 answers

1 accepted

3 votes
Answer accepted
Christian Czaia [Decadis AG]
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.
January 24, 2012

Hi Manuel,

many people actually would like this feature to be implemented. Just have a lokk at this JIRA issue dealing with your problem.

https://jira.atlassian.com/browse/JRA-7657

When I was searching for a solution I stumbled upon a plugin which could do the trick but it's not supported and I have never tried to implement it.

https://plugins.atlassian.com/plugin/details/6820?versionId=788006

Cheers

Christian

JamieA
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.
January 24, 2012

This is quite straighforward with the plugin mentioned above. Your script is just:

ComponentManager componentManager = ComponentManager.getInstance()
def customFieldManager = componentManager.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("Delivery Date")
issue.setCustomFieldValue(customField, issue.getCreated() + 14)

Providing this post-function is up at or near the top of the list of post-functions, this is all you need.

Manuel Campomanes
Contributor
February 14, 2012

I develop my own library to calculate delivery date according to working days and hours. I install JSS to use jython script.

Do you know if there is a way to get a specific workflow transition date using script ?

JamieA
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.
February 14, 2012

Something like this:

changeHistoryManager.getChangeItemsForField(issue, "status").find {it.toString == "In Progress"}?.getCreated()

0 votes
Nic Brough -Adaptavist-
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.
January 24, 2012

The Jira Suite Utilities has some basic functions (that, IMHO, Jira should have off-the-shelf), but doesn't have the more advanced stuff like manipulating fields. Christian's pointer to the scripting plugin is your best bet, as it allows a lot of flexibility.

Suggest an answer

Log in or Sign up to answer