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

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

Ben Greene August 15, 2022

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
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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

Ben Greene August 17, 2022

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?

Ben Greene August 18, 2022

@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 🙏

Ben Greene August 25, 2022

@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?

Ben Greene August 29, 2022

@Sam Harding bumping the above query.

Sam Harding
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 5, 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

Ben Greene September 6, 2022

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
AUG Leaders

Atlassian Community Events