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

This widget could not be displayed.

what jira version?

This widget could not be displayed.

JIRA version is 6.3.1

This widget could not be displayed.

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

This widget could not be displayed.

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?

This widget could not be displayed.

  

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 Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 25, 2018 in Marketplace Apps

Jira Cloud and Bitbucket Cloud Integration with Microsoft Teams

One of the newest products in the Microsoft family - Microsoft Teams,  is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...

715 views 0 3
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