Hi,
I configured a "Send custom email" postfunction and it should use on of my custom fields (Text field type) to fill in the subject and body template. I looked at https://community.atlassian.com/t5/Marketplace-Apps-Integrations/How-to-add-a-text-custom-field-value-to-custom-email-script/qaq-p/456714 and https://scriptrunner.adaptavist.com/4.3.6/jira/builtin-scripts.html#_send_a_custom_email but none of this seems to work for me.
This is a subject template I use:
${issue.key} My subject: <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("customField_name")) %> ${cfValues['customField_name'] ?: ""}
This is body template I use:
Custom field value: <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("customField_name")) %>
${cfValues['customField_name'] ?: ""}
In an email I get:
Subject:
JSD-123 My subject: <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("customField_name")) %>
Body:
For issue.getCustomFieldValue... I get Java error during Preview although this exactly follows the example in https://scriptrunner.adaptavist.com/4.3.6/jira/builtin-scripts.html#_send_a_custom_email :-(
Using ${cfValues['customField_name'] ?: ""} returns nothing similarly to subject
Any ideas? Documentation seems not to be helpful here or I'm missing something.
regards,
Szymon
I have checked on my instance, work well.
${getWorkflowButtons.call()}
test
Custom field value: <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("ios dev")) %>
Could You please check name of the custom field?
B.R.
Hi Andriej,
Thank you for help. It works now when I used:
issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Field_name"))
Do you maybe know and can explain why I needed to use ComponentAccessor instead of componentManager and the the full path "com.atlassian.jira.component.ComponentAccessor" ?
Regards,
Szymon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.