'Create page in Confluence' automation action. How to set page contents?
Asked by Ben Greene:

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?


Answers:
author: Sam Harding
body: Hi [@Ben Greene](/t5/user/viewprofilepage/user-id/4400290)

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,](https://community.atlassian.com/t5/Jira-articles/Automating-the-creation-of-a-Confluence-page-linked-to-a-Jira/ba-p/1760738) hopefully it can help you build the rule are wanting

Cheers  
Sam

comments: author: Ben Greene
body: Hi [@Sam Harding](/t5/user/viewprofilepage/user-id/3964520)

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?


author: Ben Greene
body: [@Sam Harding](/t5/user/viewprofilepage/user-id/3964520) 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 **?**


author: Ben Greene
body: [@Sam Harding](/t5/user/viewprofilepage/user-id/3964520) 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?


author: Ben Greene
body: [@Sam Harding](/t5/user/viewprofilepage/user-id/3964520) bumping the above query.


author: Sam Harding
body: Hi [@Ben Greene](/t5/user/viewprofilepage/user-id/4400290)

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


author: Ben Greene
body: Thanks for the reply [@Sam Harding](/t5/user/viewprofilepage/user-id/3964520) , sadly it still seems to break.

Result from logging that value prior to adding .asJsonString:![](https://i.gyazo.com/9c65e9a4ea1f801973e116d8cba8ca7b.png)

Result from logging that value after adding .asJsonString:

![](https://i.gyazo.com/589ee3122490784254a91aa7259eb341.png)


Tags: confluence

jira