|
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
Just 2 visible fields and looks quite simple at first. However, the form does demonstrate some advanced techniques here.
Here is how the form is configured
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
We have a "Hide field" rule, with condition set to "*", to always match, and is applied on "createdPage" field
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
IFTTT to update ConfiForms record
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 and rules (server app, but somewhat relevant to cloud version as well)
Complete solution in storage format could be found here
<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]&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> |
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 |
Examples on how to reference Confluence template within a ConfiForms IFTTT macro (assuming Confluence template has title "My Confluence template")