Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Copy Confiforms entry w/ attachments & delete old (copied) entry

Denver Thomas March 20, 2023

I have two confiforms tables, A & B, on two different pages.

I'm trying to copy an entry from A into B, along with its attachment, then delete the entry I copied from A.

I'm using two "On Modify" IFTTT's- "Create New Entry" and "Move Attachment"- to copy the entry to the new table and get the attachment to the new page as well.

So I'm most of the way there, but, when I delete the old entry from table A, my attachment is deleted from Table B's page (and thus Table B).

I'm left with an imperfect copy of the entry from Table A in Table B.

It's like the entry in Table A still has the address of where the attachment has been moved to, and still has power to delete it.

What do I need to do to achieve this? 

(Move Attachment is using [entry.fieldname.asAttachments.transform(id)] (I don't know if this is correct, it's just what worked))


Thank you very much for any and all help.

2 answers

1 accepted

2 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.
March 21, 2023

Hi @Denver Thomas 

When attachment is moved it just changes the container it belongs to (a page)

Old record still has the reference to this attachment, as it is still the same attachment

The quick woraround would be to set up and update to the original entry with "Create/Update ConfiForms Entry" IFTTT, setting the attachment field to empty (basically resetting the link to attachment). You will do it after the entry is copied and attachment is moved

entryId=[entry.id]&myattachmentfield=

Assuming the field is called "myattachmentfield"

Alex

Denver Thomas March 21, 2023

Attempting to set the attachment field to nothing, as in

myattachmentfield=

Or doing

myattachmentfield=[empty]

Is producing an error, saying the address " cannot be found.

Denver Thomas March 21, 2023

Also tried myattachmentfield="", which does not produce an error, but does nothing, apparently.

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.
March 21, 2023

Hard to understand what is your configuration and where have you done the changes you have mentioned, but

Here is a complete example

http://recordit.co/LBH3nmlFzN

And complete storage format for the solution (please note that you will need to change the target page id to match yours, mine is 133005324)

<ac:structured-macro ac:macro-id="4b649873-4ce4-41eb-a928-8a927874fd5c" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="e8dfa00a-3c96-43ac-a266-67a8c2b29c11" ac:name="confiform-entry-register" 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="7e916ed8-ae76-42dc-ab38-1b011f69e465" 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="bd75e498-a992-458f-bba1-be1fe36a4415" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">f</ac:parameter>
<ac:parameter ac:name="fieldLabel">f</ac:parameter>
<ac:parameter ac:name="type">file</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="6431fb1f-d2b8-45ed-b465-8c3d6a7ac617" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">move</ac:parameter>
<ac:parameter ac:name="fieldLabel">move?</ac:parameter>
<ac:parameter ac:name="type">checkbox</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="676bd4f0-64e1-4971-a340-898de1b45963" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[empty]</ac:parameter>
<ac:parameter ac:name="fieldName">move</ac:parameter>
<ac:parameter ac:name="action">Hide field</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="109c7874-1c6f-4680-a6a8-3967b95eb2ae" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(move):true AND move: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">t=[entry.t]&amp;f=[entry.f]</ac:parameter>
<ac:parameter ac:name="who">target:133005324</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="a0a6f27f-6f03-48cc-9b1e-4ad1586bce2c" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(move):true AND move:true</ac:parameter>
<ac:parameter ac:name="action">Move Attachment</ac:parameter>
<ac:parameter ac:name="extras">133005324</ac:parameter>
<ac:parameter ac:name="event">onModified</ac:parameter>
<ac:parameter ac:name="title">[entry.f.asAttachments.transform(id).asList]</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="32f0f3c7-b0c4-4c54-9f79-d77ffdf8ca85" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(move):true AND move: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;f=</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="753ffa2d-513d-4c7c-b784-6a5bc8a34a13" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(move):true AND move:true</ac:parameter>
<ac:parameter ac:name="action">Delete ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onModified</ac:parameter>
<ac:parameter ac:name="title">id:[entry.id]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="ab72899a-3e40-4000-b1c4-9cd050482808" ac:name="children" ac:schema-version="2"/>
</p 

 Hope it helps

Alex

Denver Thomas March 21, 2023

The video was fantastic. I was able to compare exactly what you were doing with what I was doing, 1 for 1.

This has *finally* fixed this problem for me, after hours and hours of work.

Thank you so much.

I only wish I'd asked for help sooner, lol.

0 votes
Sándor Szauer May 20, 2023

Dear @Alex Medved _ConfiForms_ ,

thanks for this solution. 

I'm wondering if it's possible to use this solution multiple times in one Form to copy the attachment into another.

I would like to arrange, that I as requestor can upload a second and a third version of a given document to the same entry in the second form. So that the decesion makers can see the previous versions as well as the new ones. Or should I use a third and a fourth Form for that?

I tried with one Form, but the entry "lost" the ID and made me a second entry instead of update the current one. I used "on created" as event and also a checkbox to say if it's the first, the second or the third version.

Or is there any other solution for such versioning? 

 

Thank you in advance,

Sándor

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 21, 2023

Hi @Sándor Szauer 

When you copy your data from one form to another then you create new records in the target form. And of course it depends what do you copy... Not sure though what do you mean by "lost" the ID...

Are you looking to update some record in the other form?

Alex

Sándor Szauer May 22, 2023

Hi Alex,

I found what the problem was. Or at least this worked:  I defined two more field in the target form which could be referenced via smart dropdown field from the original form. So that it works. 

I wanted to use the same field in all 3 IFTTT rules to update an entry including attachment from one form to the other. So it created always a new entry. 

But now it works with 3 different fields. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events