Hi, I´m trying to set up a post function script where the Enddate will be set to the end of the current month.
The actual script considers the currentdate value +30days.
Has anyone got an idea to change the +30 to endOfMonth?
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField currentDate = customFieldManager.getCustomFieldObject("customfield_11808")
Timestamp currentDateValue = (Timestamp)issue.getCustomFieldValue(currentDate)
Date newDateValue = new Date(currentDateValue.getTime())
//Add 1 month
//Update custom field
Hello @Jörg Friedmann,
You can use the following code to get end of the month. Just modify to parameters according to your currentDateValue variable.
GregorianCalendar calendar = new GregorianCalendar(2018, 8, 0);
Date date = calendar.getTime();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// dateFormat.format(date) returns the last day of the month
I guess not.
I tried some modifcations but failed, Im not able to adapt your code to mine.
ALso what I do not understand is how your code interacts with the condition to set the new date of the issue to 1month in future.
Maybe my explanation was bad. Background is I have a workflow where every issue set to done will be cloned to a new issue. This new issue shall have the end date value changed 1month forward automatically.
I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event