Forums

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

Set date field to today +10 days when click on transition

Rob B
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 15, 2018

When i click on a transition i want to populate a custom field (Date) to the current days date + 10 days. Is that possible?

Thanks

2 answers

2 accepted

0 votes
Answer accepted
Alexey Matveev
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 15, 2018
import com.atlassian.jira.component.ComponentAccessor
import java.sql.Date
import java.sql.Timestamp
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue


def csDate2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("test_date2")
Date now = new Date( new java.util.Date().getTime() );
Date csNewDateValue = new Date( now.getTime() + 10*24*60*60*1000);
csDate2.updateValue(null, issue, new ModifiedValue("", (Object) csNewDateValue), new DefaultIssueChangeHolder())
Rob B
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 15, 2018

Thanks for your help Alexey i didnt even see your reply.

0 votes
Answer accepted
Rob B
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 15, 2018

Answer - 

Set field value (JMWE add-on) - Due Date field - Groovy expression

Value:

issue.get("created") + 10

Suggest an answer

Log in or Sign up to answer