I'm having trouble understanding how to pull in a custom field within the Script Runner, Post-Function, Script workflow function, Send an email based on the provided template if conditions are met, EMAIL TEMPLATE section. Mouthful!
I've looked at the examples, none really talk about custom fields.
I can reference the Issue Key by using $issue.key, I can access the Summary using $issue.summary
The custom field name, for an example, would be "My Custom Field"
How do I reference it?
$issue.mycustomfield
or
$issue.mycustomfield.value
or
$issue.myCustomField
or $issue.myCustomField.value
Confused! Do I need to write a more elaborate script to get to custom field.
Can I use velocity
cfValues['My Custom Field']
or
cfValues['My Custom Field'].value
They didn't work.
I can do this in JETI using $!jetiFieldRenderer.renderCustomField($issue, 'customfield_11111')
not sure how to do this in script runner. I would use JETI, but I'm doing a condition test on a multiselect field and if true I send the email.
Here's the EMAIL TEMPLATE, short and sweet, how to reference a custom field?
Please review this issue:
<br>
Issue Key: $issue.key
<br>
Issue Summary: $issue.summary
<br>
Here's a link to the issue <a href='https://jira.mutualofomaha.com/jiraifs/browse/$issue.key'>$issue.key</a>
<br>
My Custom Field value is: ?????
The reason I want to send the value of the custom field is so the recipient doesn't have to
go into the issue to cut and paste the value, it will be sent to them in the email. A condition
test is causing me to not use JETI which is working well for some other emails I generate.
Thanks!
Community moderators have prevented the ability to post new answers.
Hi Joe - there is an example of this in the sample template provided in the docs: https://scriptrunner.adaptavist.com/latest/jira/builtin-scripts.html#_send_a_custom_email
Jamie, that works amazingly well, first try! I was looking at the http://docs.codehaus.org/display/GROOVY/Groovy+Templates#GroovyTemplates-GStringTemplateEngine docs, should have looked at your docs at https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Sendacustomemail
Thanks for your excellent plug-ins and quick responses!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have a problem in setting custom emails using this pluign. in To Address filedls how to use a custom field email to send address
i have used email teamplate as shown in the document but to address always hard coded in the document. where as my case i have to use a custom filed values in email.
i used following coding style in to address but its throwing errors.
1. <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("Question Answerer")).emailAddress %>
2. ${cfValues['Question Answerer'].emailAddress}
3 cfValues['Question Answerer'].emailAddress
could you please help me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Finally i found the solutions. we need to use customfield_xxxxx number in the To Fields values.
Thanks for your support.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Whats the best way to put null check for this-
Custom field value: <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("MySelect")) %>
would this work -
Custom field value: <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager()?.getCustomFieldObjectByName("MySelect")) %>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this works - <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Severity")) %>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use this - <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Severity")) %>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have a problem in setting custom emails using this pluign. in To Address filedls how to use a custom field email to send address
i have used email teamplate as shown in the document but to address always hard coded in the document. where as my case i have to use a custom filed values in email.
i used following coding style in to address but its throwing errors.
1. <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("Question Answerer")).emailAddress %>
2. ${cfValues['Question Answerer'].emailAddress}
3 cfValues['Question Answerer'].emailAddress
could you please help me
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.