After upgrading jira from 5.2.9 to 6.1.5, some groovy scripts does not work. In the log records, there is a cast exception as "Cannot cast object 'my user object' with class 'com.atlassian.jira.user.DelegatingApplicationUser' to class 'com.atlassian.crowd.embedded.api.User'
Is there any suggestions?
Thank you Henning, now it is clear. I get values from custom fields which contain users and use "User" object for return values. However, according to the document you shared above it says:
If you read values from
CustomFields containing Users. In older versions
CustomFieldsused to return
User object, in 6.0 JIRA returns
ApplicationUser. As in 6.0 these types are totally incompatible, you will probably get an exception:
java.lang.ClassCastException: com.atlassian.jira.user.DelegatingApplicationUser cannot be cast to com.atlassian.crowd.embedded.api.User
Am I right?
Yes, I need to convert ApplicationUser to User object so I use toDirectoryUsers method of ApplicationUsers class which accepts an ApplicationUser object.
Collection<User> users = (Collection) issue.getCustomFieldValue(releatedPeopleCf)//relatedPeopleCf is a multi user picker cf
Collection<User> users = (Collection) ApplicationUsers.toDirectoryUsers(issue.getCustomFieldValue(relatedPeopleCf))
This is the correct usage, isnt it?
I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...
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!
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