How to get custom field name in the Email Template using script runner?

mani@123 September 6, 2019

Hello All,

I was able to get custom field(text) value with the below script in custom email script runner in workflow transition post function.

Custom message here: <% out <<issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Custom Field Name")
) %>

 Output is as below:

Custom message here: Test123

But i want to replace Custom message here with custom field name.

Ex - Custom field Name: Test123

Is it possible? Please help.

Thanks in advance,

Manikanta

1 answer

1 accepted

0 votes
Answer accepted
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2019

Hi mani@123 

Sorry if I did not understand clearly, but you're already using hard coded custom field name.

com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Custom Field Name")

Here, Custom Field Name is the name of the custom field.

Anyway below code gives you the name of the custom field.

com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Custom Field Name").getName()

You can also get custom field name by custom field ID

com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10xxx").getName()

 where customfield_10xxx is the ID of the custom field.

I hope I was clear.

Cheers

Tuncay

mani@123 September 7, 2019

Thanks Tuncay

mani@123 September 7, 2019

Do you know how to change Text in email into Bold like below.

Bold.PNG

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2019

Try putting the text within <b> tags.

<b>bold text</b>

mani@123 September 8, 2019

It is not working. When i added the tags output i am getting like below in the emails:

<b>Submission IDs</b>

Rolf Lader
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 5, 2022

mani@123did you find a solution for your problem?

Suggest an answer

Log in or Sign up to answer