We have a table with the following structure in our database

create table cf_copy_2_db_demo (id SERIAL, name varchar(100), name2 varchar(50), confi_id_ref varchar(40));

And would like to copy the data from our form to this table

Our form has 2 fields, title and area, which will be copied to fields name and name2 in the database

We have handlers for 2 events in ConfiForms - "oncreated" and "onmodified". We create and update the record in the database based on the event occurred.

We can easily add another IFTTT handler to delete the corresponding record in the database on "ondeleted" event, if necessary








Source code for the solution

<ac:structured-macro ac:macro-id="54b51504-c3a5-481a-b8ae-16c04b500104" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:rich-text-body>
    <p>
      <br/>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="091deb8c-54c8-410b-b9cd-fb453c32f059" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">title</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Title</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="e5971607-5ec9-4451-9c92-bd40d9184ab4" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">area</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Area</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="db3f3beb-e433-454f-a5a1-4782ed6ff9a3" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">title.length:&gt;100</ac:parameter>
        <ac:parameter ac:name="fieldName">Title is too long, shall be less than 100 symbols</ac:parameter>
        <ac:parameter ac:name="action">Validation rule</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="6aa954f8-a4d2-4998-a001-36434cc729ed" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">area.length:&gt;50</ac:parameter>
        <ac:parameter ac:name="fieldName">Area is too long, shall be less than 50 symbols</ac:parameter>
        <ac:parameter ac:name="action">Validation rule</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="e769fd3d-8d27-451c-ba1a-ccf4e4d32305" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Copy ConfiForms Data to DB</ac:parameter>
      <ac:parameter ac:name="extras">7422036e-9a6f-4455-92d9-7140131fb9da</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">INSERT INTO cf_copy_2_db_demo(name, name2,  confi_id_ref) VALUES('[entry.title]', '[entry.area]', '[entry.id]')</ac:parameter>
      <ac:parameter ac:name="extras2">id:[entry.id]</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="5b4f5b76-a473-4fc0-ae47-e8dc163d6069" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Copy ConfiForms Data to DB</ac:parameter>
      <ac:parameter ac:name="extras">7422036e-9a6f-4455-92d9-7140131fb9da</ac:parameter>
      <ac:parameter ac:name="event">onModified</ac:parameter>
      <ac:parameter ac:name="title">UPDATE cf_copy_2_db_demo SET name = '[entry.title]', name2 = '[entry.area]' WHERE confi_id_ref = '[entry.id]'</ac:parameter>
      <ac:parameter ac:name="extras2">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>
<ac:structured-macro ac:macro-id="4bba00e4-cbbe-4006-9203-120fdd3d3f90" ac:name="confiform-entry-register" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:parameter ac:name="embedded">true</ac:parameter>
  <ac:rich-text-body>
    <p>
      <br/>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>