unable to resolve class com.atlassian.crowd.model.user.User with the scriptrunner 3.0.6

 

 

 

// With the following code

if (it instanceof com.atlassian.crowd.model.user.User) {  <-- ERROR             
   it.firstName +" "+ it.lastName +" ("+it.name+")"              
} else {                 
   it             
}

 

// I am receiving the following error with the scriptrunner 3.0.6

unable to resolve class com.atlassian.crowd.model.user.User

 

// my imports are:

import com.atlassian.crowd.embedded.api.User

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.config.properties.APKeys

import com.atlassian.jira.config.properties.ApplicationProperties

import com.atlassian.jira.issue.CustomFieldManager

import com.atlassian.jira.issue.Issue

import com.atlassian.jira.issue.IssueManager

import com.atlassian.jira.issue.MutableIssue

import com.atlassian.jira.issue.fields.CustomField

import com.atlassian.jira.issue.watchers.WatcherManager

import com.atlassian.jira.security.groups.GroupManager

import com.atlassian.jira.security.roles.ProjectRole

import com.atlassian.jira.security.roles.ProjectRoleManager

import com.atlassian.jira.user.util.UserUtil

import com.atlassian.jira.user.UserUtils

import com.atlassian.mail.Email

import com.atlassian.mail.MailException

import com.atlassian.mail.MailFactory

import com.atlassian.mail.queue.SingleMailQueueItem

import com.atlassian.mail.server.MailServerManager

import com.atlassian.mail.server.SMTPMailServer

import com.onresolve.scriptrunner.canned.jira.utils.ConditionUtils

import com.opensymphony.workflow.WorkflowContext

import groovy.text.GStringTemplateEngine import org.apache.log4j.Category

import org.ofbiz.core.entity.GenericValue

 

// QUESTION

How can I get rid of this error?

5 answers

0 votes

what jira version?

JIRA version is 6.3.1

0 votes

Is this in an email template? I don't think you can do imports with GStringTemplateEngine.

No This is not inside an email teplate. It is a post function configured in a specific state transition. This function was working perfectly with JIRA 6.1 and the old version (2.1.16) of scriptrunner. 

Can you reproduce this in the script console? Or is it specifically in post-functions?

  

I am not able to reproduce the error in script console because 
of another error before reaching the codeline with instanceof ... 

 

No such property: transientVars for class: SendPreDeliveryMail

groovy.lang.MissingPropertyException: No such property: transientVars for class: SendPreDeliveryMail at SendPreDeliveryMail.run(SendPreDeliveryMail.groovy:370)

that's understandable, but you can test it with just that single import as the entire script.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 11, 2018 in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

3,101 views 6 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you