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
4,359,821
Community Members
 
Community Events
168
Community Groups

'Create page in Confluence' automation action. How to set page contents?

Edited

Within the 'Create page in Confluence' action, I see no field to set the contents.

Must this all be done via a template?

If so how would I go about setting up a template that would set its content's to be equal to a Jira ticket's custom field contents?

1 answer

0 votes
Sam Harding Atlassian Team Aug 16, 2022

Hi @Ben Greene 

At this time, the content must be set via a template. This restricts how much information can be inserted into the page at creation.

If you are wanting to have more configurable options of content, there are other approaches using web requests to create content in Confluence.

Have a look at this community post, hopefully it can help you build the rule are wanting

Cheers
Sam

Hi @Sam Harding 

Thanks for the reply.

I essentially want to copy the contents of a select few Jira Custom Fields as the contents for the Confluence page I would create.

Is that something that Templates can achieve, or would I need to use a web request?

@Sam Harding I went with the linked post, but am getting this 500 Internal Server Error when attempting to validate my web request.

The full payload message:

{
"statusCode": 500,
"message": "org.codehaus.jackson.JsonParseException: Unexpected character ('H' (code 72)): was expecting comma to separate OBJECT entries\n at [Source: com.atlassian.plugins.rest.common.limitrequest.jersey.LimitingRequestFilter$1@794c9cbb; line: 3, column: 18]"
}

Also my Custom Data in case that helps:

{
"type":"page",
"title":"{{issue.Issue Title (Short description + Error text)}}",
"space":{"key":"DOC"},
"body":{
"storage":{
"value":"{{issue.Issue Reason + Screenshot(s)}} {{issue.Issue Solution + Screenshot(s)}}"}
}
}

 

I'd appreciate if you could help me spot what I might need to change to get this working 🙏

@Sam Harding this issue is a decently big blocker for us, would you be able to loop in someone who can help with this if you are not able to?

@Sam Harding bumping the above query.

Sam Harding Atlassian Team Sep 05, 2022

Hi @Ben Greene 

 

Apologies for the delayed response. To answer your questions:

Is that something that Templates can achieve, or would I need to use a web request?

This is something you would need to use a web request for, as you are doing.

am getting this 500 Internal Server Error

It would appear that the JSON data being sent to the API is considered invalid JSON (despite what you have pasted being valid). I suspect this is due to the values being injected by the smart values. Can you print out what this smart value is in the audit log

"title":"{{issue.Issue Title (Short description + Error text)}}"

If I am reading the error correctly, I would suspect the title contains text with a quote character followed by an H like so

"H...."

When smart values prints it out, it will cause the json block to incorrectly formatted. You can try to fix that by using `asJsonString` on your smart value, like so:

{{issue.Issue Title (Short description + Error text).asJsonString}}

 Hope that helps,
Sam

Thanks for the reply @Sam Harding , sadly it still seems to break.

 

Result from logging that value prior to adding .asJsonString:

 

Result from logging that value after adding .asJsonString:

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Atlassian Automation

Jira Automation: Sum Up Story Points Roundup (Initiatives -> Epics -> Story/Tasks -> Subtasks)

Hi Everyone, In this roundup we combine all the jira automation rules to sum up story points across different issue types. We start from the lowest level, summing up story points from sub-tasks t...

3,099 views 10 9
Read article

Atlassian Community Events