Hi All,
I am trying to send a custom email using "Scriptrunner send custom email" template where I am retrieving values of some issue fields. I am able to it successfully for summary, description etc but not able to understand how I can do it for multi user field "Implementer". The code that I used below extracts the Username(id) rather than the Full Display name. Rest of other fields are working as expected.
When I use .getDisplayName() method it errors out. Could you suggest a solution for it?
The following Change request has been approved (Issue $issue).
Summary:
$issue.summary
Description:
$issue.description
Approved Window Start:
<% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Approved Window Start")) %>
Approved Window End:
<% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Approved Window End")) %>
Change Implementer:
<% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Implementer")).getDisplayName() %>
Hi @Veda Bhat,
I hope this solve your issue:
Change the last line as following:
<% out << ((issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Implementer")) as List<com.atlassian.jira.user.ApplicationUser>).collect { it.displayName }) %>
Hi @Veda Bhat,
you should change the last line as following:
<% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Implementer")) as com.atlassian.jira.user.ApplicationUser).getDisplayName() %>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for you response! I tried modifying the last line as you mentioned above and got below error:
java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMail(AbstractSendCustomEmail.groovy:240)
at java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMail(AbstractSendCustomEmail.groovy:240)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.super$4$constructMail(SendCustomEmail.groovy)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Veda Bhat,
your issue could be in the condition or in other sections of your ScriptRunner send custom mail. Please, could you report the configuration?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do not have anything specified under Condition and Configuration section of "Scriptrunner Send custom email". The reason is I have added this as a post function to a transition in a workflow. Whenever this transition happens it should send this email to a distro list .
All other fields are retrieving accurate values as you can see in result window below except this one multi user field called " Implementer" which retrieves user names as id instead of full name:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Veda Bhat,
the problem was due to the fact that your custom field Implementer is a multi-user and not a single-user custom field. So, to solve the issue, look my last answer.
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.