The script failed : javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.crowd.embedded.ofbiz.OfBizUser.getPropertySet() is applicable for argument types: () values: []
Possible solutions: getProperties()
2013-07-16 07:46:12,495 http-6443-2 ERROR wb391456 466x18x1 6s8xt0 10.185.5.137,10.185.160.15 /secure/QuickCreateIssue.jspa [onresolve.jira.groovy.GroovyFunctionPlugin] Error executing post-function
javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.crowd.embedded.ofbiz.OfBizUser.getPropertySet() is applicable for argument types: () values: []
Possible solutions: getProperties()
Script is
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.security.roles.ProjectRoleActors
import com.atlassian.jira.project.Project
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.CustomFieldType
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.util.UserManager
import org.apache.log4j.Category
log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
MutableIssue myIssue = issue
ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
ProjectRoleManager projectRoleManager = (ProjectRoleManager) ComponentManager.getComponentInstanceOfType(ProjectRoleManager.class)
UserManager userManager = (UserManager) ComponentManager.getComponentInstanceOfType(UserManager.class)
Project myProject = myIssue.getProjectObject()
def techLead = myIssue.getProjectObject().getLead()
String projectKey = myIssue.getProjectObject().getKey()
String compKey = ""
String appCriticality = ""
def componentLeads = myIssue.getComponentObjects()
def businessLead
myIssue.getComponentObjects().each{ c ->
if (c.getLead()) {
techLead = userManager.getUser(c.getLead())
}
}
myIssue.getComponentObjects().each{ c ->
if ( c.getDescription() != null && c.getDescription().indexOf('{') != null) {
compKey = c.getDescription()
compKey = compKey.substring(compKey.indexOf('{') + 1,compKey.indexOf('}') )
}
}
compKey = compKey?:projectKey
//Get the first business lead
ProjectRole projectRole = projectRoleManager.getProjectRole('Business Lead')
Collection businessLeads = new ArrayList()
ProjectRoleActors projectRoleActors = projectRoleManager.getProjectRoleActors(projectRole , myProject)
projectRoleActors.getRoleActors().each {
businessLeads.add(it.getUsers())
}
61
62 try {
63 businessLead = businessLeads[0]
64 } catch(Throwable e){}
65 try {
66 if ( userManager.getUser("appowner").getPropertySet().getString("jira.meta." + compKey) != null ) {
67 businessLead = userManager.getUser(userManager.getUser("appowner").getPropertySet().getString("jira.meta." + compKey ))
68 }
69 } catch(Throwable e) {}
70
71 CustomField cfTechLead = customFieldManager.getCustomFieldObjectByName( "Technical Lead" )
72 CustomField cfBusLead = customFieldManager.getCustomFieldObjectByName( "Business Lead" )
73 CustomField cfAppCriticality = customFieldManager.getCustomFieldObjectByName( "Criticality of the App" )
74 CustomField cfIssueSubType = customFieldManager.getCustomFieldObjectByName( "Issue sub-type" )
75
76 myIssue.setCustomFieldValue(cfTechLead, techLead)
77 myIssue.setCustomFieldValue(cfBusLead, businessLead)
78 if( myIssue.issueType.name == "xxx")
79 {
80 appCriticality = userManager.getUser("appcriticality").getPropertySet().getString("jira.meta." + compKey )
81 try {
82 myIssue.setCustomFieldValue(cfAppCriticality , appCriticality.substring( 0,appCriticality.indexOf(':') ))
83 }catch(Throwable e){}
84 }
85 else {
86 myIssue.setCustomFieldValue(cfIssueSubType , myIssue.issueType.name )
87 }