How to reference a Custom Field Value in a Confluence Page

Hi guys,

Im trying to post a custom field value in a Confluence Page when a JIRA issue is created (post function). I tried to do to as follows but it didnt work for me.


def cField1 = customFieldManager.getCustomFieldObject("customfield_10008")
def cField2 = customFieldManager.getCustomFieldObject("customfield_10009")
def cField3 = customFieldManager.getCustomFieldObject("customfield_10201")

def writer = new StringWriter()
def xml = new MarkupBuilder(writer)
xml.'ac:structured-macro' ('ac:name': "jira") {
'ac:parameter' ('ac:name': "key", issue.key)

// add more paragraphs etc

xml.p ("${issue.getCustomFieldValue(cField1)}")
xml.p ("${issue.getCustomFieldValue(cField2)}")
xml.p ("${issue.getCustomFieldValue(cField3)}")


I've imported:

import com.atlassian.applinks.api.ApplicationLink
import com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.api.application.confluence.ConfluenceApplicationType
import com.atlassian.jira.issue.Issue
import com.atlassian.sal.api.component.ComponentLocator
import groovy.json.JsonBuilder
import groovy.xml.MarkupBuilder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueManager


And the error i recieve is:

2017-09-14 17:18:19,174 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2017-09-14 17:18:19,174 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: SMP-19, actionId: 1, file: <inline script>
groovy.lang.MissingPropertyException: No such property: customFieldManager for class:


Im really stuck here, can someone help me? thanks in advance.

1 answer

1 accepted

1 vote
Answer accepted

hey Alejandro, 

You will need, after the imports, something like 

def customFieldManager  = ComponentAccessor.customFieldManager

Thank you Thanos, It worked perfectly

Hi Thanos,


I resolved the problem with your suggestion but now i want to "italic" the text, and I dont know how to do it, I tried to search something similar in the web but with no luck.


Can you help me with this? (I tried this code below)

xml.p ("<em>${issue.getCustomFieldValue(cField1)}"</em>")
xml.p ("<em>${issue.getCustomFieldValue(cField2)}</em>")
xml.p ("<em>${issue.getCustomFieldValue(cField3)}</em>")

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

571 views 1 14
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you