Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I render a Confluence page programatically?

Sammo Gabay
March 29, 2018

When somebody creates a blog post in one of our Confluence pages, we want to e-mail the content to a distribution list. I have successfully created an event listener using ScriptRunner to call a mail-dispatch API and send the raw page content, which renders all right as HTML in an e-mail client. However, any macros in the content are in raw wiki code form and are not rendered. How can I use the Confluence Java API to render the page content to (X)HTML and send that to my e-mail service?

I am well versed with the Jira Java API and ScriptRunner but am newer to the Confluence API, but I have noticed much overlap.

2 answers

2 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Mohamed Benziane
Community Champion
October 24, 2022

Hi,

You can try something like this:

import static com.atlassian.jira.issue.IssueFieldConstants.COMPONENTS
def components = getFieldById(COMPONENTS)



1 vote
Answer accepted
WindHub Support
Contributor
October 24, 2022

I think I've found the answer myself:

def ComponentsField = getFieldById("components")
ComponentsField.setRequired(false); ComponentsField.setHidden(true); ComponentsField.setFormValue(null);
TAGS
AUG Leaders

Atlassian Community Events