I would like to add 1 month to a custom date field (Next Cycle Date) and then update that date field upon a workflow transition (post-function).
I have the current script but it's not doing anything, not sure what I am doing wrong.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.UpdateIssueRequest
import java.text.SimpleDateFormat
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MMM/yy");
java.sql.Timestamp nextCycleDate = (java.sql.Timestamp)issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10603")) //get current "next cycle date"
nextCycleDate.setMonth(nextCycleDate.getMonth() + 1) //add 1 month to current cycle date to get next cycle date
issue.setCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10603"), nextCycleDate) //update next cycle date
Shoot, I thought I had commented out "<?xml version="1.0" encoding="ISO-8859-1"?>" in the other templates, but I hadn't of course... :-p
It's working like a charm now!
Yes, that was the problem. (Your XML was not well formatted.)
If you have a commercially supported license with the plugin, then please post your questions and problems to Midori's support tracker at https://midori.zendesk.com/
You can expect immediate help there, we are not visiting Atlassian Answers every day.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've found a couple of differences in some of the other templates.
I think
$issues.get(0).project.key
could be the cause of the error - anye ideas? If anyone have a different method, that will of course do... :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.