I used to get this code worked but now it breaks
and have error message like this:
2014-09-04 17:07:35,846 http-bio-8080-exec-24 ERROR QA1 1027x947457x2 i3kw56 10.1.247.38 /secure/QuickCreateIssue.jspa [groovy.canned.utils.ConditionUtils] javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: value for class: com.atlassian.jira.user.DelegatingApplicationUser
Possible solutions: name
============
for the condition:
cfValues['Solution Provider(SBM)']?.value != null
for the addtional code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager;
import org.apache.log4j.Category
import com.atlassian.jira.issue.MutableIssue
/**
* The template script for setting the assignee from a custom user picker
* Make sure the user chosen is assignable.
*/
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction");
log.setLevel(org.apache.log4j.Level.DEBUG);
def issueManager = ComponentAccessor.getIssueManager();
ComponentManager componentManager = ComponentManager.getInstance();
def customFieldManager = componentManager.getCustomFieldManager();
def cf = customFieldManager.getCustomFieldObjectByName("Solution Provider(SBM)");
if (cf == null) {
log.error("No custom field-Solution ProviderSBM found");
return;
}
def user = issue.getCustomFieldValue(cf);
if (user != null) {
def user2 = user.getDirectoryUser();
log.error("Setting assignee to: " + user2.getName());
log.error("Issue type : " + issue.getClass().getName());
issue.setAssignee(user2);
issue.store();
}