A client runs an online travel auction site to raise money for charities. Each auction can have multiple winners. The winners are captured in a repeatable field section on Form A—the invoice form. When a new invoice entry is created, the invoice is automatically added to QuickBooks Online through Zapier. When the invoice payment is recorded in QuickBooks Online, the details are updated in Form A, again via Zapier. Once Form A is updated, the client requires that new entries are auto-created in Form B—the thank you form. There needs to be one entry for each winner from Form A. Form B is essentially a clone of Form A but without the repeatable section. How do we do this?
The client requested that we use the Formidable API add-on to create the new entries in Form B. He also pointed to a code snippet in the Formidable knowledgebase that demonstrates how to pass information from one repeatable field section to another through the API using raw JSON.
While this solution is fairly easy to implement and works great for transferring information between forms where both have a repeatable field section, there is no way to get this to work to create multiple entries in another form without a repeatable field section.
After studying the Zapier add-on code, we learned that the plugin hooks into the frm_after_update_entry action at priority 41. This means that hooking into the same action at a higher priority should give us what we need to create the entries in Form B. In this case, we're hooking into frm_after_update_entry at priority 50.
The code first loads the common fields for all new thank you form entries, then loops through the repeatable field on the invoice form to load each winner entry fields to variables. Then, while still in the loop, we create each new thank you form entry.