Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Creating structured pages in Confluence with ConfiForms is very easy thanks to the built-in ConfiForms IFTTT action called "Create Page"

The form itself will look like this

Image Modified

Just 2 visible fields and looks quite simple at first. However, the form does demonstrate some advanced techniques here. 

  1. Creates a page based on the template given, and also put's a reference to the field, which defines it's content. The reference is dynamic, and changing the record's value will be reflected on the created page
  2. After the page get's created we store a reference to the created page back to the ConfiForms, in a hidden (by rule) field of "page" type
  3. A concept of using the result of a previous IFTTT execution is demonstrated here, storing created page ID

Here is how the form is configured

Image Modified

Here, we have a ConfiForms FormView macro embedded inside the Form Definition (could be separate, but for the demo purpose it is inside).

Then we have 3 fields and a rule to hide the 3rd field, which is used to store the reference to created page

  • 1st field, called "title", is of type "text"
  • 2nd field is called "contents" and it is of type "textarea"
  • 3rd field is called "createdPage" and is of type "page"

We have a "Hide field" rule, with condition set to "*", to always match, and is applied on "createdPage" field

Image Modified

Image Modified

Then we have 2 IFTTT rules, one to Create a Page based on the template included - we have a Panel macro and a field, "contents", placed inside this panel

And another IFTTT to create/update the ConfiForms record with the result of the previous IFTTT

Here is how these are configured

  1. IFTTT to create a page. See important parameter for giving a name for the result of this macro (last parameter). We will use it in the 2nd IFTTT
    Image Modified
    Image Modified
    Image Modified
  2. IFTTT to update ConfiForms record
    Image Modified

    Code Block
    entryId=[entry.id]&createdPage=${iftttResult_PC.id}

    As you can see, we take the result of IFTTT macro by name "PC" and take the ID from it's result. Page object is returned by the IFTTT rule when you create a page. More on IFTTT results Configuring ConfiForms IFTTT actions (server app, but somewhat relevant to cloud version as well)


Complete solution in storage format could be found here

Code Block
<ac:structured-macro ac:name="confiform" ac:schema-version="1" ac:macro-id="11931ee1-11ef-49b2-a8ee-7b80ed03d796">
  <ac:parameter ac:name="formName">pagecreator</ac:parameter>
  <ac:rich-text-body>
    <p class="auto-cursor-target"><br/></p>
    <ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1"
                         ac:macro-id="5e3a46f9-565e-453a-af0c-2c0ec84a1e12">
      <ac:parameter ac:name="withPageReload">true</ac:parameter>
      <ac:parameter ac:name="formName">pagecreator</ac:parameter>
      <ac:rich-text-body>
        <p><br/></p></ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1"
                           ac:macro-id="fa1f535c-c982-49d6-9d41-8162a20b9b0b">
        <ac:parameter ac:name="fieldName">title</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Page title</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
        <ac:parameter ac:name="required">true</ac:parameter>
      </ac:structured-macro>
    </p>
    <p class="auto-cursor-target">
      <ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1"
                           ac:macro-id="30d8030c-ba22-445c-a14d-b092fea9c61d">
        <ac:parameter ac:name="fieldName">contents</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Contents</ac:parameter>
        <ac:parameter ac:name="type">textarea</ac:parameter>
      </ac:structured-macro>
    </p>
    <p class="auto-cursor-target">
      <ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1"
                           ac:macro-id="c2fd53b9-3f41-48c6-9484-5dc3699c8eb2">
        <ac:parameter ac:name="fieldName">createdPage</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Created page</ac:parameter>
        <ac:parameter ac:name="type">page</ac:parameter>
      </ac:structured-macro>
    </p>
    <p class="auto-cursor-target">
      <ac:structured-macro ac:name="confiform-field-definition-rules" ac:schema-version="1"
                           ac:macro-id="6c5be51c-f4cd-445d-a827-d9c298e99e8f">
        <ac:parameter ac:name="condition">*</ac:parameter>
        <ac:parameter ac:name="fieldName">createdPage</ac:parameter>
        <ac:parameter ac:name="action">Hide field</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:name="confiform-ifttt" ac:schema-version="1"
                         ac:macro-id="e3f881de-c426-4924-b0f8-f0a244df4436">
      <ac:parameter ac:name="action">Create Page</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">[entry.title] - created by ConfiForms</ac:parameter>
      <ac:parameter ac:name="resultName">PC</ac:parameter>
      <ac:rich-text-body>
        <h2>Page created with the following contents</h2>
        <ac:structured-macro ac:name="panel" ac:schema-version="1" ac:macro-id="bf16e5c9-0c3b-4717-a25b-af4932cb810b">
          <ac:rich-text-body>
            <p>
              <ac:structured-macro ac:name="confiform-field" ac:schema-version="1"
                                   ac:macro-id="140e27f3-32a2-4035-964a-3a10c4cb0844">
                <ac:parameter ac:name="fieldName">contents</ac:parameter>
              </ac:structured-macro>
            </p>
          </ac:rich-text-body>
        </ac:structured-macro>
        <p class="auto-cursor-target"><br/></p></ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target"><br/></p>
    <ac:structured-macro ac:name="confiform-ifttt" ac:schema-version="1"
                         ac:macro-id="db131b93-1b0e-45cd-b0e4-900052d0f663">
      <ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">entryId=[entry.id]&amp;createdPage=${iftttResult_PC.id}</ac:parameter>
      <ac:rich-text-body>
        <p><br/></p></ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target"><br/></p></ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target"><br/></p>
<ac:structured-macro ac:name="confiform-table" ac:schema-version="1" ac:macro-id="c96467ee-ca34-4b66-ac76-5dcd6410e8ff">
  <ac:parameter ac:name="formName">pagecreator</ac:parameter>
  <ac:rich-text-body>
    <p><br/></p></ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target"><br/></p>
<p class="auto-cursor-target"><br/></p>
<p class="auto-cursor-target">
  <ac:structured-macro ac:name="children" ac:schema-version="2" ac:macro-id="eebdbb88-00ef-44fb-838e-431a22475f51"/>
</p>


Info

We have added support for using Confluence templates to create pages with ConfiForms


As in server version of ConfiForms you can reference your template via [template.<TEMPLATE_NAME>] inside your ConfiForms IFTTT macro to create a page / blogpost


See these tutorials (server version) to understand the concept and see the examples

https://wiki.vertuna.com/label/CONFIFORMS/templates