Hi
I am using a scriptrunner and their build in scripts. Under Workflows I have made a Post Function using their build in "Send a custom email".
I have made the email in HTML and added the $issue.key $issue.summary to the Subject - So that JEHM will se the email if the client responds to the email.
I works very well, byt i want to ad som flair.
The Client email is in a custom field, and i want the email to say:
Dear Customername
I have used:
${issue.fields.customfield_XXXXX}
but it does not work? Also how do i remove the @email.com from the custom filed?
Do I need something in the "Condition and Configuration"
For your requirement, you could try something like:-
Dear <% out << issue.getCustomFieldValue(customFieldManager.getCustomFieldObject('customfield_14840')).toString().substring(0, issue.getCustomFieldValue(customFieldManager.getCustomFieldObject('customfield_14840')).toString().indexOf('@')).trim() %>
Basically, the sample code above is using the String object's substring method to trim the String starting from the @ symbol.
Then only issue is that you will need to add the entire method call because it is not possible to use an object reference in this.
Below are a few test screenshots for your reference:-
1. When the issue is created, the sample email john.williams@gmail.com is added to the Text Field
2. When the issue is created, the Sample Text field is displayed and a sample comment is added
3. Finally, when the email is sent out, the email address is truncated starting from the @ symbol only displaying the recepient's name.
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Søren Hansen For custom fields try to use following code :-
Dear <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_14840")) %>
Thanks
V.Y
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is a text field.
JEHM takes the email from the sender and puts it this custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
okay, thanks for sharing the field type. I am not sure, how to split name from email address. Let me add Scriptrunner expert who can help you.
@Ram Kumar Aravindakshan _Adaptavist_ Kindly help us in removing "@mail.com" part from text field.
Thanks
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.