ConfiForm delete entries in nested forms
Asked by Maximilian Herbert:

Hey there, hey alex :)  

I have a form1 that has a field of the type smart multi row ("SMR1"). Form2 is input for SMR1.

If I create an entry in Form1 there are 1-n entries created in Form2.

Now I am struggling with the following:  
When I delete the entry in Form1 the 1-n entries in Form2 wont get deleted.  
As there is no link in Form2 to which of Form1 it belongs its nearly impossible for me to delete them afterwards.  

Is there a possibility to get all entries in Form2 deleted when their corresponding entry in Form1 gets deleted?  

Greetz Max


Answers:
author: Alex Medved _ConfiForms_
body: Yes, you can do that - using the <https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-DeleteConfiFormsEntry> to run onDeleted

And having a filtering expression as we show here with "join" function <https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions>

Alex

comments: author: Maximilian Herbert
body: Good to know that this is possible - is there a showcase /usecase somewhere to see how that works?  
Gonna try it out by myself as well :)  
Greetz and thanks

Max


author: Maximilian Herbert
body: Hey Alex,  

after a lot of try and error I still havent found any good solution for me.  

I have 2 forms:  
F1, F2

F1 has a Smart Multi Row pointing on the fields of F2

When an entry gets created in F1 with 2 inputs on the Smart multi row, 2 entries get generated in F2 - so far so good

Now if I delete the entry in F1 I want those 2 entrys in F2 to be deleted as well.

But in both of the F2 entries there is no logical link to the "root" F1 Entry.

I thought about adding a field in the F2 that gets updated after the creation with the ID of the entry of F1 but as there is no link I cant really reliably find the right entries.

Is there any way I can set a field in F2 that is by default at the value of the ID in F1 that creates the entry?  

About your tip with the join -\> I cant really figure out how to do it and how this could help me :/

<br />

Greetz and happy new year tho   
Max


author: Alex Medved _ConfiForms_
body: Little demo of what I was trying to explain

<http://recordit.co/BjXqQ1Iewf>

with a source code (please note that you will need to reconfigure the smart field to point at your page/form (F2))

```
<ac:structured-macro ac:macro-id="7a56ed2c-d603-4504-9c6d-ba8de09414e3" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">F1</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="a58b5ab2-992c-41ef-a7af-7af509ceaaaa" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">smr</ac:parameter>
<ac:parameter ac:name="fieldLabel">smr</ac:parameter>
<ac:parameter ac:name="values">[169902260:F2]t,ta,</ac:parameter>
<ac:parameter ac:name="type">smartmultirow</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="09dc6677-c20e-477e-bff7-e310a1d054e7" 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="de3ee45b-3b85-4b67-9aa6-6217dd805ac2" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Delete ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onDeleted</ac:parameter>
<ac:parameter ac:name="title">id:[entry.smr.transform(id).join( OR id:)]</ac:parameter>
<ac:parameter ac:name="who">F2</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="c75d4e55-1128-4f39-bded-2ccafeaec683" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">F2</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="8c3871a4-2d31-4980-b004-0f1d9b5728aa" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">t</ac:parameter>
<ac:parameter ac:name="fieldLabel">t</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="8ddb3d2e-066a-4330-b29d-5689ab980107" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">ta</ac:parameter>
<ac:parameter ac:name="fieldLabel">ta</ac:parameter>
<ac:parameter ac:name="type">textarea</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
```

Hope it helps

Alex


author: Maximilian Herbert
body: I mean what should I say.... THANKS(!!!) again so much. It works perfectly fine - I gotta be honest - I dont really understand the logic how it works but it obviously works!  

Greetz Max


author: Jeff Weisman
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) I'm having this same issue! Tried following the link to your demo but looks like it's dead. Any chance you can share the video / re-link / share directly? ?


author: Alex Medved _ConfiForms_
body: Hi [@Jeff Weisman](/t5/user/viewprofilepage/user-id/3524388)

There is a complete configuration as a storage format provided (few comments above). Not sure if the video is any better, but here it is

[https://wiki.vertuna.com/download/attachments/178782502/ConfiForm%20delete%20entries%20in%20nested%20forms.mov?version=1\&amp;modificationDate=1713854916871\&amp;api=v2](https://wiki.vertuna.com/download/attachments/178782502/ConfiForm%20delete%20entries%20in%20nested%20forms.mov?version=1&amp;modificationDate=1713854916871&amp;api=v2)

Hope it helps

Alex


Tags: confiforms

confluence-server

server