Page tree
Skip to end of metadata
Go to start of metadata

In this tutorial you will learn how to use Confluence templates with ConfiForms

There is a bit simpler tutorial about the concept of using Confluence templates within ConfiForms, Advanced integrations with IFTTT macros with ConfiForms


You can reference Confluence templates from:

  • ConfiForms IFTTT macro which creates a Confluence page
  • Confluence IFTTT macro which sends email NEW
  • Confluence IFTTT macro which creates attachment from a content given (and the content now can be kept in a central place as a template) NEW
  • ConfiForms Registration Control NEW 

Referencing Confluence templates (what is Confluence template? Read more here https://confluence.atlassian.com/conf57/working-with-templates-701434852.html) is done as follows:

[template.TEMPLATE NAME AS YOU SEE IT in TEMPLATES FORM]

Please be aware that the contents of the template will be evaluated against the values in the record used to create a page using this template, but you can include it without evaluating the paramteres from ConfiForms version 1.47.2

FROM VERSION 1.47.2

You can include the template without evaluating it's parameters.

[rawtemplate.TEMPLATE NAME AS YOU SEE IT in TEMPLATES FORM]

The contents of the template "TEMPLATE NAME AS YOU SEE IT in TEMPLATES FORM" will be included as-is, sometimes this is very handful, especially when you create pages with other ConfiForms Forms and have included instructions to use [entry.field_name] or IFTTT results



For example, a template is named: "My first template"

Rfererencing it in ConfiForms will be like this:

[template.My first template]


Now we will proceed with the ConfiForms Form setup, which will use the same template for customizing the form, creating the page which shows the page the form with same layout and we will also send an email which will reuse the same template for form layout with some additional information.


Let's start with form configuration (if you a new to ConfiForms please have a look first at Creating a simple form in Confluence with ConfiForms tutorial). It will be a ConfiForms form with 3 fields:

  • text field (name: subject)
  • wysiwyg field (name: msgdetials)
  • drop down field (name: choice)

This is how the Form looks like in the editor

And now is the most intersting part

As you can see, we have added 2 IFTTT macros, one to create a page, another one to send email (If we need to save the link to a newly created page in ConfiForms - it is also possible, but will require another IFTTT to be added, Creating links in original ConfiForms entry to just created page). In this tutorial, for simplicity reason, we do not store the link within the form.

As you can see from the screenshot above, we are referencing "mytemplate" from 3 different places, from IFTTTs, and from ConfiForms Registration Control

[template.mytemplate]

So, our template name in Confluence is "mytemplate"

The content of this template is the following:

FROM VERSION 1.47.2

You can include the template without evaluating it's parameters.

[rawtemplate.mytemplate]

The contents of the template "mytemplate" will not be evaluated against the current record, but will be included as-is



This gives us the unified view of the form in the page created, email sent and when user fillins the form


The page created:

And the email sent with the same content

As you can see the tenmplate was added and parsed and styling was also sept, but misses the CSS used by Confluence. 

If you need to mimic the page in Confluence you will need to add custome CSS styles into IFTTT body macro



 Complete solution in storage format can be found here:
<ac:structured-macro ac:macro-id="87547728-9eca-49b5-8b3a-842168920b66" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="a26ca8e6-514d-476a-b1cd-b03914bb8c47" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">subject</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Subject</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
      <ac:structured-macro ac:macro-id="59f8f010-45de-47db-92ec-9ac567ecd074" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">msgdetails</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Message details</ac:parameter>
        <ac:parameter ac:name="type">wysiwyg</ac:parameter>
      </ac:structured-macro>
      <ac:structured-macro ac:macro-id="40cc9a55-bfc5-4abc-8e6c-a8b452c87264" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">choice</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Choice</ac:parameter>
        <ac:parameter ac:name="values">false[1=Choice 1|2=Choice 2|3=Choice 3|]</ac:parameter>
        <ac:parameter ac:name="type">select</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="4697ec46-2f85-459e-8350-0462b846b840" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Create Page</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">[entry.subject]</ac:parameter>
      <ac:rich-text-body>
        <p>Hello<strong> [entry.createdBy.fullName]</strong>
        </p>
        <p>
          <span>[template.mytemplate]</span>
        </p>
        <p>
          <span>
            <ac:structured-macro ac:macro-id="4ed7249e-7ba0-4b5d-9e66-9ad7e4c624f1" ac:name="confiform-entry-edit" ac:schema-version="1">
              <ac:parameter ac:name="inline">true</ac:parameter>
            </ac:structured-macro>
            <br/>
          </span>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="cc2cd11f-31f3-4197-9471-53e6b7e25373" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Send Email</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="who">sasha@vertuna.com</ac:parameter>
      <ac:rich-text-body>
        <p>This page was created from a <strong style="line-height: 1.42857;">Confluence template</strong> by <span style="line-height: 1.42857;"> [entry.createdBy.fullName] on <span> [entry.created.formatDate(dd.MM.yyyy HH:mm)]</span>
          </span>
        </p>
        <p>
          <span>[template.mytemplate]</span>
        </p>
        <p>
          <span>
            <br/>
          </span>
        </p>
        <p>
          <span>The page can be found here:</span>
        </p>
        <ac:structured-macro ac:macro-id="36e9dcc9-8ea0-48e6-942f-d267a90550db" ac:name="html" ac:schema-version="1">
          <ac:plain-text-body><![CDATA[<a href="http://localhost:1990/confluence/pages/viewpage.action?pageId=${iftttResult_0.id}">${iftttResult_0.displayTitle}</a>]]></ac:plain-text-body>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>
<p>
  <ac:structured-macro ac:macro-id="cd00333a-69b4-4156-9d85-3f6f6b5f4e55" ac:name="confiform-entry-register" ac:schema-version="1">
    <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
    <ac:rich-text-body>
      <p>[template.mytemplate]</p>
    </ac:rich-text-body>
  </ac:structured-macro>
</p>