We have deprecated built-in audit functionality in ConfiForms, here is some details on why we have made this decision: Audit log has been deprecated - what to do

This is the tutorial to help you with implementing your own audit rules.

This tutorial uses ConfiForms version 1.51.6!

And extended version of "hasChanged" function (Virtual functions) where you are able to use it to recognise ANY change (not only of a particular field)


We will have a simple form with 3 fields:

Storage format for this form

<ac:structured-macro ac:macro-id="5132151c-0bb2-4bfa-a5a4-c27bb993d28b" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">myform</ac:parameter>
  <ac:parameter ac:name="registrationFormTitle">My form</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="6129161d-3145-491b-bfd6-796c9209b02d" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mytextfield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My text field</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="1a1f5778-2a87-48ea-997d-4e19c57f0f3f" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mychoices</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My choices</ac:parameter>
        <ac:parameter ac:name="values">false[1=one|2=two|3=three|4=four|5=five|]</ac:parameter>
        <ac:parameter ac:name="type">select2</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="98c61930-5353-4973-868b-9a5ca3cfa154" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">myuser</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My user</ac:parameter>
        <ac:parameter ac:name="type">user</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="87a5f990-d915-4cd7-9038-8fa447cf1195" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>



And we want to track any change done in this form and will store these changes in the form with the following structure

We have a similar form with one additional field called "originalRecordId" where we will store the ID of the record we audit

<ac:structured-macro ac:macro-id="ab1e9f7e-b372-4e0a-b5e5-5056c7188da4" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">originalRecordId</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Original Record Id </ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>


No, we will add 2 IFTTT into our 1st form ("myform") to enable rules to copy the data into the "myauditform"

Configuration looks like this in the editor (there is a complete configuration on the bottom on the page)

We set IFTTT rules to use "Create ConfiForms Entry" and set these to execute on Created/Updated events in ConfiForms when a condition:

hasChanged():true

Please note that this function is supported from 1.51.6 version of ConfiForms, untill this version you can use only the function to track individual changes of each field.

Which means, for the form we have we will need to list any property to be checked for changes and the condition for IFTTT will look like this

hasChanged(mytextfield):true OR hasChanged(mychoices):true OR hasChanged(myuser):true

The IFTTT copies the data into "myaditform"



Parameters to set are as follows

originalRecordId=[entry.id]&mytextfield=[entry.mytextfield]&mychoices=[entry.mychoices]&myuser=[entry.myuser]

So, we set the "originalRecordId" to the ID of the record we make an audit entry for, and we copy all the other fields from our "myform" into "myaditform" (in this configuration scenario they have fields with same names, but this is not a requirement at all. It is just more convenient to have them like that)

Now we will build a view over the data in our main from and show the audit log next to it. Something like this:

This view is configured like this:

<ac:structured-macro ac:macro-id="96483d12-61ef-48cb-91bd-a701a6e4a54c" ac:name="confiform-list" ac:schema-version="1">
  <ac:parameter ac:name="formName">myform</ac:parameter>
  <ac:rich-text-body>
    <table class="wrapped">
      <colgroup>
        <col/>
        <col/>
        <col/>
        <col/>
      </colgroup>
      <tbody>
        <tr>
          <td>
            <div class="content-wrapper">
              <p>
                <ac:structured-macro ac:macro-id="0232da28-3b7e-496f-87ff-7cb650bee7fc" ac:name="confiform-field" ac:schema-version="1">
                  <ac:parameter ac:name="fieldName">mytextfield</ac:parameter>
                </ac:structured-macro>
              </p>
            </div>
          </td>
          <td>
            <div class="content-wrapper">
              <p>
                <ac:structured-macro ac:macro-id="eb82a890-82d5-4722-ac8b-ca4dd9063353" ac:name="confiform-field" ac:schema-version="1">
                  <ac:parameter ac:name="fieldName">mychoices</ac:parameter>
                </ac:structured-macro>
              </p>
            </div>
          </td>
          <td colspan="1">
            <div class="content-wrapper">
              <p>
                <ac:structured-macro ac:macro-id="3737d176-3663-4f94-a101-7abab06219f6" ac:name="confiform-field" ac:schema-version="1">
                  <ac:parameter ac:name="fieldName">myuser</ac:parameter>
                </ac:structured-macro>
              </p>
            </div>
          </td>
          <td colspan="1">
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="2e1b4b46-82e6-489b-b8d8-5f6ddf8b1b06" ac:name="expand" ac:schema-version="1">
                <ac:parameter ac:name="title">Show audit for the record...</ac:parameter>
                <ac:rich-text-body>
                  <ac:structured-macro ac:macro-id="1266379b-db9b-48af-a6fc-e2c4f8a64b68" ac:name="confiform-table" ac:schema-version="1">
                    <ac:parameter ac:name="filter">originalRecordId:[entry.id]</ac:parameter>
                    <ac:parameter ac:name="formName">myauditform</ac:parameter>
                    <ac:rich-text-body>
                      <p>
                        <ac:structured-macro ac:macro-id="fc544f60-0cd3-4a77-91f3-c0699e55d6a4" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="fieldName">mytextfield</ac:parameter>
                        </ac:structured-macro>
                      </p>
                      <p>
                        <ac:structured-macro ac:macro-id="348d71a1-7833-4524-892c-e8457dbaa91c" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="fieldName">mychoices</ac:parameter>
                        </ac:structured-macro>
                      </p>
                      <p>
                        <ac:structured-macro ac:macro-id="7f3b7a87-f08e-4f9a-8de4-fea5f34c7dd3" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="fieldName">myuser</ac:parameter>
                        </ac:structured-macro>
                      </p>
                      <p>
                        <ac:structured-macro ac:macro-id="c2eb2030-9fb7-4215-9529-d1d0855a9179" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="overrideLabel">When</ac:parameter>
                          <ac:parameter ac:name="fieldName">created</ac:parameter>
                        </ac:structured-macro>
                      </p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                </ac:rich-text-body>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </ac:rich-text-body>
</ac:structured-macro>


With help of ConfiForms IFTTT rules and the "hasChanged" function (Virtual functions) you can setup your own audit rules, which have not only copying functionality to track changes, but also to notify interested parties via emails when certain event and condition happens with ConfiForms record, or to create automatic pages or other notifications (informing external web services or saving a record data into an external database). 


Here is the full listing of the configuration (storage format). You can use Confluence Source editor to import this configuration into your Confluence

<ac:structured-macro ac:macro-id="5132151c-0bb2-4bfa-a5a4-c27bb993d28b" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">myform</ac:parameter>
  <ac:parameter ac:name="registrationFormTitle">My form</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="6129161d-3145-491b-bfd6-796c9209b02d" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mytextfield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My text field</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="1a1f5778-2a87-48ea-997d-4e19c57f0f3f" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mychoices</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My choices</ac:parameter>
        <ac:parameter ac:name="values">false[1=one|2=two|3=three|4=four|5=five|]</ac:parameter>
        <ac:parameter ac:name="type">select2</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="98c61930-5353-4973-868b-9a5ca3cfa154" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">myuser</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My user</ac:parameter>
        <ac:parameter ac:name="type">user</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="87a5f990-d915-4cd7-9038-8fa447cf1195" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="36556fed-7348-451a-953e-6db9ced465ae" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="condition">hasChanged():true</ac:parameter>
      <ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">originalRecordId=[entry.id]&amp;mytextfield=[entry.mytextfield]&amp;mychoices=[entry.mychoices]&amp;myuser=[entry.myuser]</ac:parameter>
      <ac:parameter ac:name="who">myauditform:this</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="73d63d16-5448-415c-a157-34599f6a92ed" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="condition">hasChanged():true</ac:parameter>
      <ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
      <ac:parameter ac:name="event">onModified</ac:parameter>
      <ac:parameter ac:name="title">originalRecordId=[entry.id]&amp;mytextfield=[entry.mytextfield]&amp;mychoices=[entry.mychoices]&amp;myuser=[entry.myuser]</ac:parameter>
      <ac:parameter ac:name="who">myauditform:this</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="c90a9d32-9316-4e43-9d2b-8eb3e32777da" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">myauditform</ac:parameter>
  <ac:parameter ac:name="registrationFormTitle">Audits for my form</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="ab1e9f7e-b372-4e0a-b5e5-5056c7188da4" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">originalRecordId</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Original Record Id </ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="df60aa79-79b1-4d1f-ae62-9091a89970ad" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mytextfield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My text field</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="1a224a7c-c273-4db1-be6a-fb4c1c009e4e" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mychoices</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My choices</ac:parameter>
        <ac:parameter ac:name="values">false[1=one|2=two|3=three|4=four|5=five|]</ac:parameter>
        <ac:parameter ac:name="type">select2</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="edb23466-673c-4dae-b206-0fa433949d57" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">myuser</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My user</ac:parameter>
        <ac:parameter ac:name="type">user</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <br/>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p>
  <br/>
</p>
<p>Showing data from myform with full audit</p>
<ac:structured-macro ac:macro-id="96483d12-61ef-48cb-91bd-a701a6e4a54c" ac:name="confiform-list" ac:schema-version="1">
  <ac:parameter ac:name="formName">myform</ac:parameter>
  <ac:rich-text-body>
    <table class="wrapped">
      <colgroup>
        <col/>
        <col/>
        <col/>
        <col/>
      </colgroup>
      <tbody>
        <tr>
          <td>
            <div class="content-wrapper">
              <p>
                <ac:structured-macro ac:macro-id="0232da28-3b7e-496f-87ff-7cb650bee7fc" ac:name="confiform-field" ac:schema-version="1">
                  <ac:parameter ac:name="fieldName">mytextfield</ac:parameter>
                </ac:structured-macro>
              </p>
            </div>
          </td>
          <td>
            <div class="content-wrapper">
              <p>
                <ac:structured-macro ac:macro-id="eb82a890-82d5-4722-ac8b-ca4dd9063353" ac:name="confiform-field" ac:schema-version="1">
                  <ac:parameter ac:name="fieldName">mychoices</ac:parameter>
                </ac:structured-macro>
              </p>
            </div>
          </td>
          <td colspan="1">
            <div class="content-wrapper">
              <p>
                <ac:structured-macro ac:macro-id="3737d176-3663-4f94-a101-7abab06219f6" ac:name="confiform-field" ac:schema-version="1">
                  <ac:parameter ac:name="fieldName">myuser</ac:parameter>
                </ac:structured-macro>
              </p>
            </div>
          </td>
          <td colspan="1">
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="2e1b4b46-82e6-489b-b8d8-5f6ddf8b1b06" ac:name="expand" ac:schema-version="1">
                <ac:parameter ac:name="title">Show audit for the record...</ac:parameter>
                <ac:rich-text-body>
                  <ac:structured-macro ac:macro-id="1266379b-db9b-48af-a6fc-e2c4f8a64b68" ac:name="confiform-table" ac:schema-version="1">
                    <ac:parameter ac:name="filter">originalRecordId:[entry.id]</ac:parameter>
                    <ac:parameter ac:name="formName">myauditform</ac:parameter>
                    <ac:rich-text-body>
                      <p>
                        <ac:structured-macro ac:macro-id="fc544f60-0cd3-4a77-91f3-c0699e55d6a4" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="fieldName">mytextfield</ac:parameter>
                        </ac:structured-macro>
                      </p>
                      <p>
                        <ac:structured-macro ac:macro-id="348d71a1-7833-4524-892c-e8457dbaa91c" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="fieldName">mychoices</ac:parameter>
                        </ac:structured-macro>
                      </p>
                      <p>
                        <ac:structured-macro ac:macro-id="7f3b7a87-f08e-4f9a-8de4-fea5f34c7dd3" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="fieldName">myuser</ac:parameter>
                        </ac:structured-macro>
                      </p>
                      <p>
                        <ac:structured-macro ac:macro-id="c2eb2030-9fb7-4215-9529-d1d0855a9179" ac:name="confiform-field" ac:schema-version="1">
                          <ac:parameter ac:name="overrideLabel">When</ac:parameter>
                          <ac:parameter ac:name="fieldName">created</ac:parameter>
                        </ac:structured-macro>
                      </p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                </ac:rich-text-body>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </ac:rich-text-body>
</ac:structured-macro>