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 vote

what jira version?

JIRA version is 6.3.1

0 vote

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

66 views 0 5
Read article

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