ConfiForms: Udpate ConfiForms entry - change history

Bartosz Drożdżal May 23, 2024

Hi @Alex Medved _ConfiForms_ 

I have such a case. In Form I have 4 fields:
Field1 - Text
Field2 - Text
FIeld3 - Text
FieldHTML - HTML

The FieldHTML field wants to store all changes that will occur in the form.
That's why I created 3 IFTTT Create/Update Entry onModified:

1) Condition: hasChanged(field1):true
Parameters to set:
entryId=[entry.id]&fieldHTML=[entry._previousState.fieldHTML] <br> [entry._now.formatDate(yyyy-MM-dd HH:mm:ss)] - [entry._user.fullName] - New value " Field1": [entry.field1.label]

2) Condition: hasChanged(field2):true
Parameters to set:
entryId=[entry.id]&fieldHTML=[entry._previousState.fieldHTML] <br> [entry._now.formatDate(yyyy-MM-dd HH:mm:ss)] - [entry._user.fullName] - New value " Field3": [entry.field2.label]

2) Condition: hasChanged(field3):true
Parameters to set:
entryId=[entry.id]&fieldHTML=[entry._previousState.fieldHTML] <br> [entry._now.formatDate(yyyy-MM-dd HH:mm:ss)] - [entry._user.fullName] - New value " Field3": [entry.field3.label]

If I change the value of only one field, the history of changes is stored correctly.
The problem occurs when I change the values ​​of more than one field. The FieldHTML field shows only the change in one field.

Is there a way to update the content of a FieldHTML field if I change the value of more than one field?

Przechwytywanie.PNG

 

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2024

Hi @Bartosz Drożdżal 

This works correctly, as the "_previousState" is always the state of the record that initiated the IFTTT

Alex

Bartosz Drożdżal May 23, 2024

@Alex Medved _ConfiForms_ 

Do you have any idea how to make the FieldHTML field keep information about updating several values ​​at the same time?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2024

Honestly, in this case the audit IFTTT actions sounds much more reasonable, but fine.

I would use an extra hidden field to collect the "change log" and then update the "fieldHTML"

Have a look at this demo:

https://wiki.vertuna.com/download/attachments/178782502/Community%20-%20ConfiForms-%20Udpate%20ConfiForms%20entry%20-%20change%20history.mov?version=1&amp;modificationDate=1716483671737&amp;api=v2

and the configuration as storage format is below

<p>
<span style="color: rgb(23,43,77);">
<a class="" href="https://community.atlassian.com/t5/Confluence-questions/ConfiForms-Udpate-ConfiForms-entry-change-history/qaq-p/2706522">https://community.atlassian.com/t5/Confluence-questions/ConfiForms-Udpate-ConfiForms-entry-change-history/qaq-p/2706522</a>
</span>
</p>
<p style="text-align: left;">
<br/>
</p>
<ac:structured-macro ac:macro-id="93cc9523-f547-4e3e-b48a-98b5bc9e4d32" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:parameter ac:name="debugMode">true</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="e10fc07d-8053-4919-956d-77ac3a953b0b" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="type">Embedded</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="b59cfda1-de90-4088-8e52-758186a9c34a" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Field1</ac:parameter>
<ac:parameter ac:name="fieldLabel">Field1</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="45d8ae74-816e-4fff-ac73-0505abd50188" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Field2</ac:parameter>
<ac:parameter ac:name="fieldLabel">Field2</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="ac69d8e7-8d03-4cba-bd36-b4baeb9eff5c" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Field3</ac:parameter>
<ac:parameter ac:name="fieldLabel">Field3</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<p>
<ac:structured-macro ac:macro-id="f82b30b8-a204-4bca-a0f6-fbfdb598c2fc" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">FieldHTML</ac:parameter>
<ac:parameter ac:name="fieldLabel">FieldHTML</ac:parameter>
<ac:parameter ac:name="extras">true</ac:parameter>
<ac:parameter ac:name="type">hiddenhtml</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="3c164e8d-d78b-4346-8aba-0476041ea4fe" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">changeLog</ac:parameter>
<ac:parameter ac:name="fieldLabel">changeLog</ac:parameter>
<ac:parameter ac:name="type">hidden</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="45f23534-da4e-456b-86b0-6e41ec8baea8" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(Field1):true</ac:parameter>
<ac:parameter ac:name="extras3">true</ac:parameter>
<ac:parameter ac:name="extras4">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">entryId=[entry.id]&amp;changeLog=[entry.changeLog][entry._now.formatDate(yyyy-MM-dd HH:mm:ss)] - [entry._user.fullName] - New value " Field1": [entry.Field1]&lt;br&gt;</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="3a014afd-6528-40df-a2eb-906451b30637" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(Field2):true</ac:parameter>
<ac:parameter ac:name="extras3">true</ac:parameter>
<ac:parameter ac:name="extras4">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">entryId=[entry.id]&amp;changeLog=[entry.changeLog][entry._now.formatDate(yyyy-MM-dd HH:mm:ss)] - [entry._user.fullName] - New value " Field2": [entry.Field2]&lt;br&gt;</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="fb4a3317-e6b0-4c67-aea7-89305eb2b89d" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(Field3):true</ac:parameter>
<ac:parameter ac:name="extras3">true</ac:parameter>
<ac:parameter ac:name="extras4">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">entryId=[entry.id]&amp;changeLog=[entry.changeLog][entry._now.formatDate(yyyy-MM-dd HH:mm:ss)] - [entry._user.fullName] - New value " Field3": [entry.Field3]&lt;br&gt;</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="bb763ec4-fb21-4369-aafd-d00146e14743" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">(hasChanged(Field1):true OR hasChanged(Field2):true OR hasChanged(Field3):true) AND !changeLog:[empty]</ac:parameter>
<ac:parameter ac:name="extras3">true</ac:parameter>
<ac:parameter ac:name="extras4">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">entryId=[entry.id]&amp;FieldHTML=[entry._previousState.FieldHTML][entry.changeLog]&amp;changeLog=</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p style="text-align: left;">
<br/>
</p>
<ac:structured-macro ac:macro-id="a379fcf4-518a-493c-8a51-98d981418080" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="4604939d-9c92-4032-a954-0572f53b5388" ac:name="confiform-entry-edit" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="6281f462-f54e-402e-999a-2c052ecbf1f2" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Field1</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="4d1379a0-6081-4786-8a3b-a2447acc3cab" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Field2</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="6dea674f-a480-4a52-9b8c-3e839b6f0926" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">Field3</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="a84a400e-b66e-489c-910d-7dc39be8eda5" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">FieldHTML</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p style="text-align: left;">
<br/>
</p>

Hope it helps

Alex

Bartosz Drożdżal May 24, 2024

Perfect, that's exactly what I wanted! :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events