Im trying to add a custom field into a script runner email template.
Dear ${issue.assignee?.displayName},
Value = $issue.getCustomFieldValue("Partner")
Regards
${issue.reporter?.displayName}
Reporter and assignee works fine but the custom field throws error out.
Thanks
Try something like this.
def partnerField = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Partner")
def partner = issue.getCustomFieldValue(partnerField)?.toString() ?: ""
You can either include that code inside a <% ... %> block at the top of the Email Template field, or you can include it in the Condition and Configuration section, and then assign the value to a config variable that you can then reference in the template, e.g.
config.partner = partner
Then you can reference $partner in the template.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.