It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

Thanks Tuncay

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

Bold.PNG

Try putting the text within <b> tags.

<b>bold text</b>

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

<b>Submission IDs</b>

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

342 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you