I have to update the due date of a subtask based on the custom field called "Launch Date" in the Parent issue. I am trying to test my code:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp
def customFieldManager = ComponentAccessor.getCustomFieldManager()
cfParent = customFieldManager.getCustomFieldObjectByName('Launch Date') //Launch Date is the custom field to be moved from the parent
parentMyFieldValue = transientVars["issue"].getCustomFieldValue(cfParent)
if (DueDate < CurrentDate()) //condition so that due date is not before current date
{
issue.setDueDate(CurrentDate())
}
else
{
issue.setDueDate(cfParent, new Timestamp((new Date() - 14).time))
}I am also getting errors related to transientVars.
I am new to groovy so any help would be really useful. Thank you so much!