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

How to create a populated Confluence Page from a Form with Automation

Valerie Capasso January 16, 2023

I have written an automation rule to create a confluence page when a specific form is submitted through our JSM service project. But the page that is created is blank. Is there a way to populate the page with the data that is submitted in the form that triggered the automation rule?

The background info is that we want our client operations team to submit requests for new data feeds via our service project. I am building out a request type that contains a Form for them to complete. We then want to use the information in that form to create a confluence page for documentation purposes.

datafeedautomation.JPG

1 answer

1 accepted

1 vote
Answer accepted
Gideon Nolte [Jodocus]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2023

Hi @Valerie Capasso,

 

been there, done that. I'll cover my findings/approach briefly. Feel free to come back to me if you need more insight on any of the points below.

 

  1.  Content creation in Confluence via Jira Automation
    1. Currently the most reliable way to do this is via the Confluence REST API 
    2. I would suggest using a technical user for the page creation
    3. You will have to authenticate the web request via Basic Auth with mail and API Key
    4. I had success with the following payload to create content via POST {{baseUrl}}/wiki/rest/api/content
    5. {"title": "<The page title>",
      "space": { "key": "<The key of the space>"},
      "type": "page",
      "metadata": {
      "properties":{
      "editor": {
      "value": "v2"
      }
      }
      },
      "ancestors": [
      {
      "id": "<id of the parent page>"
      }
      ],
      "body": {
      "storage": {
      "representation": "storage",
      "value": "<the storage representation of the ticket>"
      }
      }
      }
    6. To get the the key of the space just look in the URL of the space
    7. Same for the ID of the parent page
    8. To get the storage representation you want to tokenize, use the rest API endpoint GET /wiki/rest/api/content/<pageId>?expand=body.storage 
    9. Once you created the page, you will get a response with the page id - I suggest saving this ID as an issue property. The SmartValue to do so is: {{webhookResponse.body.id}}
    10. NOTE: Automation for Confluence is a thing for enterprise and premium customers - currently the content creation is limited, but what you are trying to accomplish might become a standard function in the future
  2. Use the form data in the Automation rule
    1. Form data is stored in the issue properties which can be accessed via {{issue.properties."proforma.forms.i1".state.answers.1.text}}
    2. Note that the last part of the SmartValue "1.text" is different for each question. The number represents the id of the question. text may be date or choices or something else.
    3. To see the data you are accessing, see: GET /rest/api/3/issue/<issueKey>/properties/proforma.forms.i1

 

I hope this points you to the right directions. As said: Feel free to ask for more information on any part of the rundown.


Greetings
Gideon

Valerie Capasso January 17, 2023

Thanks for the response!

Another question for you, do you know if the opposite is possible? If our client operations team populates a table on a Confluence page with information/data is there a way to take that table and populate it into the associated service desk request.

I realize I might be asking for too much here. :) I'm trying to create a one stop shop for our team to submit information to our tech team the most efficient way possible without having them required to complete steps in multiple locations.

Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events