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

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 Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

530 views 6 9
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot