Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Creating a Template Comments (Jira Service Management) does not work

Marco Brundel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 21, 2021


With Template Comments (Jira Service Management) in Scriptrunner I want to create a template comment that also prints the value of a custom field in the comment.

I've gone through the documentation at, but unfortunately I can't get the comment to work.

In Template I’ve the code


Dear $customerFirstName,

The name of the created Backoffice is $backofficeCf



In Condition/Code I’ve

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager= ComponentAccessor.getCustomFieldManager()

def backofficeCf = customFieldManager1.getCustomFieldObjectByName("Backoffice name")


But I get the warning

Variable “customFieldManager” masks a binding variable of the same name.

I just don't understand how to solve this.

Anyone have any tips to solve it?

Thank you very much,

Regards Marco

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jun 21, 2021

Hi @Marco Brundel

From your description, the reason why the code appears to be failing is that. 

1) You are initialising a bound variable, i.e. customFieldManager, as shown in the image below:-


The example code provided in the documentation is a bit outdated and needs to be updated.

2) Whenever you want to pass the value from the Groovy code into the Comment template, you will need to use the config variable. However, you are directly passing the variable, i.e. backofficeCf, into your template in your case. This will not work.

Below is an example working code for your reference:-

import com.atlassian.jira.component.ComponentAccessor

def sampleList = customFieldManager.getCustomFieldObjectsByName("Sample List")[0]

config.sampleListValue = issue.getCustomFieldValue(sampleList) ?: 0

return true

Please note, this example code is not 100% exact to your environment. Hence, you will need to make the required modifications.

Below is a print screen of the configuration:-

config.pngIf you observe the print screen above, I am passing the config.sampleListValue into the comment template i.e. 

The value selected is ${config.sampleListValue}

 Below is an example of the output:-


I hope this helps to answer your question. :)

Thank you and Kind Regards,


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events