Hi,
I am facing below ERROR with my below post function script. Please let me know what is the wrong in the script used while re-assigning the reporter value/user to Test Manager custom field value?
2017-06-06 17:20:01,541 ERROR [utils.WorkflowUtils]: In-depth checking of each condition follows to determine why the action was not allowed.
2017-06-06 17:20:01,542 ERROR [utils.WorkflowUtils]:
(PASS)
PASS: Only users in project role Release(INT) can execute this transition.
2017-06-06 17:20:01,543 ERROR [utils.WorkflowUtils]: {customfield_10034=Could not find usernames: admin(admin)}
2017-06-06 17:20:01,543 ERROR [utils.WorkflowUtils]: Not attempting transition because of above errors.
My post function script as follows::
import com.atlassian.jira.component.ComponentAccessor
String reporter = issue.reporter
issue.setAssigneeId(reporter)
def componentCF0 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Test Managers")
def selectedComponents0 = issue.getCustomFieldValue(componentCF0)
issue.setCustomFieldValue(componentCF0, reporter)
issueInputParameters.setComment('Re-Assiging to Design PR Reporter to validate and close the PR has it has not ITG Test Scope ')
//def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Test Managers'}
//issueInputParameters.addCustomFieldValue(cf.id, reporter)
//issue.setCustomFieldValue(selectedComponents0, reporter)
My issue has the below details and trying to change the Test Manager custom field value to Reporter name using the above script in my transition post function.
The following will be processed after the transition occurs
I tried to modify my groovy script as below based on one community answer shared it before, now there is no ERROR seen. But modified value for Test Managers custom field is not displayed in the Jira issue screen and has old value only. Eventhough i am able to get the modified value correctly in the script using log.info()
Do I still missing something in my below script??? Please advice.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.util.IssueChangeHolder import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.util.DefaultIssueChangeHolder String reporter = issue.reporter?.name issue.setAssigneeId(reporter) def componentCF0 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Test Managers") def selectedComponents0 = issue.getCustomFieldValue(componentCF0) issue.setCustomFieldValue(componentCF0, reporter) Object cfVal = issue.getCustomFieldValue(componentCF0) log.info(cfVal) IssueChangeHolder changeHolder = new DefaultIssueChangeHolder() componentCF0.updateValue(null, issue, new ModifiedValue("", reporter), changeHolder); issue.store(); issueInputParameters.setComment('Re-Assiging to Design PR Reporter to validate and close the PR has it has not ITG Test Scope ')
Hi,
Please find the working post function script as per the specific use case shared in this question/community/FYR.
But somehow same postfunction working script doen's work in when we use in Fast-track transition - not sure why?
ScriptRunner workflow function - Fast-track transition an issue (condition & additional actions apply
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.user.ApplicationUser def componentCF2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("ITG To Test") String selectedComponents2 = issue.getCustomFieldValue(componentCF2) def componentCF1 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Defect Source") String selectedComponents1 = issue.getCustomFieldValue(componentCF1) if(selectedComponents1 == "Design Server" && selectedComponents2 == "NO") { String reporter = issue.reporter?.name issue.setAssigneeId(reporter) String reporter1 = issue.reporter?.name CustomField multiUser = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Test Managers") List<ApplicationUser> users; //= (List<ApplicationUser>) issue.getCustomFieldValue(multiUser) if(users == null) users = new ArrayList<>(); users.add(ComponentAccessor.getUserManager().getUserByName(reporter1)) issue.setCustomFieldValue(multiUser, users); }
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.