Hello
I am using scriptrunner postfunction Send a custom email, to send email & in the email body, I need to include some custom field values. I am trying to get the field values with below expression, however, it is not working.
issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("MyField"))
Could you please help me with the information, how can I include custom field value in the email please ?
Thanks!
Managed to get the field value myself in the mail body using <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Custom Field Name")) %>
Hi Vishal, I hope you are doing well.
Actually I´m using this line in my body mail <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("MyFieldName")) %>
I want to set another custom field but in this case of "User Picker" type.
Do you know how can I set it?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure if I get your question, so you are trying to fetch the user picker field value in the mail, correct ? If so above should work.
Vishal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vishal
Yes, for example, I have a "user picker" custom field called "Architect" and I want the body of the email say something like this.
Hi (Name of the "Architect")
You must approve this ticket (URL ticket)
Thank you so much.
Rgards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are using post function then you need to use : <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Architect")) %>
If you are using simple jira automation then you need to use : {{customfield_12345.displayName}}
Hope it helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Not sure if it's the only issue but getCustomFieldObjectByName("MyField") return a List of field because in some case there is multiple fields with the same name even if it's not a good practice.
Use getCustomFieldObjectByName("MyField")?.first()
Or use Field ID getCustomFieldObject("customfield_XXXX")
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.