Page tree

This is the documentation for ConfiForms Server/Data Center app

However, this might also work for ConfiForms cloud and in most cases it does. But please see this page to understand the differences between server and cloud versions of the ConfiForms app.


As on the Atlassian community post (https://community.atlassian.com/t5/Confluence-questions/Keeping-two-ConfiForms-in-sync/qaq-p/2679409) we take the same structure as an example to show how to use the newly developed "Synchronize smart field references" ConfiForms IFTTT action

Available on DC, version 3.11 and on CLOUD


The problem

We have two forms that need to update one another and stay in sync. For simplicity sake lets use this mock-example. A librarian has a form (form 1) that they use to update information on the library to include the books that the library has available.


Form 1 - Libraries
Field 1 - Library Name - Text Field
Field 2 - Library Description - Text Field
Field 3 - Books Available - Smart Multi-Checkbox Field (Source Form - Books)


Form 2 - Books
Field 1 - Book Name - Text Field
Field 2 - Book Description - Text Field
Field 3 - Libraries - Smart Multi-Select Field (Source Form Libraries)


When a librarian is updating their library's record in the Library form they need to select all of the books that the library has available, and remove any selections that it no longer has available. They do this using the smart multi-checkbox field in the library form registration/edit.

When the librarian saves that form we also need to pass the library name to the Books form for each book record, or remove it if the librarian has unselected the book. The books form/views is used to see what libraries a book is available in, and has many downstream views and filters separate from the library form.

What macros/functions do we need to use to maintain this sync between the two forms? We also have a similar use case with a smart multi-row field. But we're assuming the solution for the above will tackle this.

Confiforms view.png

Confiforms config.png


We will use the newly introduced ConfiForms IFTTT macro to synchronize smart multi-value holding fields to reference each other

So, BooksAvailable (Libraries form) always holds links to Books, and Libraries (Books form) is always up to date with links to libraries. Links are kept automatically, no matter where you make the change - in the Books or in the Libraries form

We will need 3 ConfiForms IFTTTs of this new type "Synchronize smart field references" in each form

Here is how to configure them


Form: Libraries

Handling 3 events: OnCreated, OnModified and onDeleted

OnCreated

OnModified

(almost the same as onCreated, but with a slight difference on "condition" parameter - ie, when to trigger this event)

OnDeleted


Form: Books

Also 3 IFTTTs set to trigger onCreated, onModified and onDeleted events with a configuration as follows

OnCreated

OnModified

OnDeleted


That's it! This way you can set up bi-directional synchronized (smart) fields


<ac:structured-macro ac:macro-id="a7904b06-2731-4aa3-bd3f-43658c43ef96" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">Libraries</ac:parameter>
  <ac:parameter ac:name="debugMode">true</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="a5de7793-c841-4eed-9b5e-61c0f3ed36f2" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">LibraryName</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Library Name</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
        <ac:parameter ac:name="required">true</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="0719b200-1121-4c0e-998f-2cfbfbcf5433" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">LibraryDescription</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Library Description</ac:parameter>
        <ac:parameter ac:name="type">textarea</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="2e7c6c69-d833-46fb-ac8a-9cf2adc521f6" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">BooksAvailable</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Books Available</ac:parameter>
        <ac:parameter ac:name="values">[180945272|Books|BookName|true||]</ac:parameter>
        <ac:parameter ac:name="type">smartcheckbox</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="968f82a7-420a-49e2-8e94-849fe1a1b408" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br/>
    </p>
    <ac:structured-macro ac:macro-id="444864ae-9469-4838-af20-c261f7c4ebf5" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="condition">!BooksAvailable:[empty]</ac:parameter>
      <ac:parameter ac:name="formName">Libraries</ac:parameter>
      <ac:parameter ac:name="action">Synchronize smart field references</ac:parameter>
      <ac:parameter ac:name="extras">Libraries</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">BooksAvailable</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:parameter ac:name="macroHash">-1738927223</ac:parameter>
      <ac:parameter ac:name="who">Books</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br/>
    </p>
    <ac:structured-macro ac:macro-id="1bcc25c8-e067-484e-95e0-7b4c10e3b038" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="condition">hasChanged(BooksAvailable):true</ac:parameter>
      <ac:parameter ac:name="formName">Libraries</ac:parameter>
      <ac:parameter ac:name="action">Synchronize smart field references</ac:parameter>
      <ac:parameter ac:name="extras">Libraries</ac:parameter>
      <ac:parameter ac:name="event">onModified</ac:parameter>
      <ac:parameter ac:name="title">BooksAvailable</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:parameter ac:name="macroHash">1770462209</ac:parameter>
      <ac:parameter ac:name="who">Books</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br/>
    </p>
    <ac:structured-macro ac:macro-id="d45d3c2a-1d56-4d53-a413-2376af2a0171" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="formName">Libraries</ac:parameter>
      <ac:parameter ac:name="action">Synchronize smart field references</ac:parameter>
      <ac:parameter ac:name="extras">Libraries</ac:parameter>
      <ac:parameter ac:name="event">onDeleted</ac:parameter>
      <ac:parameter ac:name="title">BooksAvailable</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:parameter ac:name="macroHash">-737758078</ac:parameter>
      <ac:parameter ac:name="who">Books</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 style="text-align: left;">Libraries</p>
<ac:structured-macro ac:macro-id="9c77f5c9-6f65-4168-877a-efbb4ed4101b" ac:name="confiform-table" ac:schema-version="1">
  <ac:parameter ac:name="formName">Libraries</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="7381d4ee-45ac-4587-81b1-8801b4e5f2cb" ac:name="confiform-entry-edit" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <br/>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p style="text-align: left;">
  <br/>
</p>
<ac:structured-macro ac:macro-id="ba2ce7af-bfab-4ff5-bb64-15aedd084eb5" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">Books</ac:parameter>
  <ac:parameter ac:name="debugMode">true</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="34d7c28f-307e-47ce-9fd0-de6392e2a33c" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">BookName</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Book Name</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
        <ac:parameter ac:name="required">true</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="19dbda8a-358f-41e9-b1fd-08e9d66636fd" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">BookDescription</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Book Description</ac:parameter>
        <ac:parameter ac:name="type">textarea</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="2a779bb9-b8a8-46bb-934a-2ced8d44b2e3" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">Libraries</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Libraries</ac:parameter>
        <ac:parameter ac:name="values">[180945272|Libraries|LibraryName|true||]</ac:parameter>
        <ac:parameter ac:name="type">smartmultiselect</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="1fdf5cc0-b9b9-4dcf-bc33-123c663103b2" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <br/>
    </p>
    <p class="auto-cursor-target">
      <br/>
    </p>
    <ac:structured-macro ac:macro-id="804c7b6c-a8f4-4c64-9b88-79bfabc48b3a" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="condition">!Libraries:[empty]</ac:parameter>
      <ac:parameter ac:name="formName">Books</ac:parameter>
      <ac:parameter ac:name="action">Synchronize smart field references</ac:parameter>
      <ac:parameter ac:name="extras">BooksAvailable</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">Libraries</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:parameter ac:name="macroHash">-563933469</ac:parameter>
      <ac:parameter ac:name="who">Libraries</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br/>
    </p>
    <ac:structured-macro ac:macro-id="57fb8127-6773-43a8-9322-58f2570f6e34" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="condition">hasChanged(Libraries):true</ac:parameter>
      <ac:parameter ac:name="formName">Books</ac:parameter>
      <ac:parameter ac:name="action">Synchronize smart field references</ac:parameter>
      <ac:parameter ac:name="extras">BooksAvailable</ac:parameter>
      <ac:parameter ac:name="event">onModified</ac:parameter>
      <ac:parameter ac:name="title">Libraries</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:parameter ac:name="macroHash">-1164741553</ac:parameter>
      <ac:parameter ac:name="who">Libraries</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br/>
    </p>
    <ac:structured-macro ac:macro-id="4ec19b0e-b2a3-4958-9384-d0defe1a03ca" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="formName">Books</ac:parameter>
      <ac:parameter ac:name="action">Synchronize smart field references</ac:parameter>
      <ac:parameter ac:name="extras">BooksAvailable</ac:parameter>
      <ac:parameter ac:name="event">onDeleted</ac:parameter>
      <ac:parameter ac:name="title">Libraries</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:parameter ac:name="macroHash">-1483779556</ac:parameter>
      <ac:parameter ac:name="who">Libraries</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>Books</p>
<ac:structured-macro ac:macro-id="f5313d4c-18ca-4f31-9b70-53f4c2cb464a" ac:name="confiform-table" ac:schema-version="1">
  <ac:parameter ac:name="formName">Books</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="e42db318-1b11-491c-b84b-dd8c81921f59" ac:name="confiform-entry-edit" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <br/>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>



  • No labels