Hey all,
I recently found this script online that I have modified a bit and am using to return email address for users inside a scripted field. The only issue is, the returned string has each individual character separated by a comma and I can't seem to find a way to fix this online.
Additionally, the script seems to run despite the errors on the side. The script is below.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.user.ApplicationUser def uxfield = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("UX") if (uxfield == null) return "custom field not found" StringBuilder result = new StringBuilder(); for(ApplicationUser user: (ArrayList<ApplicationUser>) uxfield.getValue(issue)) result.append(user.getEmailAddress() + "/") return result.toString().substring(0, result.toString().length() -1)
Happy to help but please, instead of pasting code you found on the web, can you please describe the use-case? Secondly, can you let us know what type you plan to return? We can't see the searcher you set on the field and we can't see the template you configured.
Sure. I am using it to convert usernames from one field to display their email addresses for reporting purposes in the scripted field. The searcher is set for a multi-user picker field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.