Hi,
I need to create two subtasks when a particular checkbox (custom) field value is checked. I am using Code Runner plugin and Jira version 7.1.6
Script used;
import com.atlassian.jira.component.ComponentAccessor;
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.user.util.UserManager;
import com.atlassian.jira.issue.MutableIssue
def issueManager = ComponentAccessor.getIssueManager();
//def userManager = ComponentAccessor.getUserManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def cField = customFieldManager.getCustomFieldObject("customfield_14201");
def cFieldValue = issue.getCustomFieldValue(cField);
if (cFieldValue == "Yes") {
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().loggedInUser
CommentManager commentMgr = ComponentAccessor.getCommentManager()
commentMgr.create(issue, currentUser, cFieldValue, true)
}