Bachelor Tech
  • Home
  • Tutorials
  • Portfolio
  • About Jan
  • Contact Jan

Part 4b – Integromat Workflow – Submit the parent gravity form from Integromat

by Jan Bachelor May 8, 2022

Last Updated on May 8, 2022 by Jan Bachelor

Length: 120 minutes|Difficulty: Hard
Table of Contents
  • Pre-requisities for this step
  • Define a Data Store & Process records from the spreadsheet
  • Load items from the spreadsheet to find out for whom reports will be created.
  • Aggregate fields from the spreadsheet & de-duplicate the names
  • Find whether a parent Gravity Form has already been created for each employee.
  • Submit a parent Gravity form if there is no existing pending one
  • Make.com blueprint .JSON file

Pre-requisities for this step

  • A bank-provided comma (or other-delimited) CSV file export of transactions.
  • A Google Workspace business account (you could replace it with an O365 account, instead, to conver the comma delimited CSV file to a spreadsheet format).
  • An Integromat account (a free subscription will work).
  • A WordPress site with Gravity Forms installed.
  • RESP API allowed in Gravity Forms’ settings with a generated customer key and secret to allow a submission of a Gravity form from Integromat. We will basically pre-fill the form on behalf of the user.

Define a Data Store & Process records from the spreadsheet

Fetch expenses from the spreadsheet to get the names of users for whom a report is to be created.
  • Create a ‘Data Store’ tile called ‘Delete all records’. At the very beginning, we have nothing to clear out but we will once some data will start coming in. Create a new data store structure using the ‘Add’ button. We will need to store 4 items in there:
    • Employee name
    • WordPress ID (of the user)
    • Gravity Form entry ID
    • CSV file ID
Structure of the Data Store that will be used later to create individual expenses for each person’s report

Load items from the spreadsheet to find out for whom reports will be created.

  • Provide the spreadsheet ID from the tile used for uploading and converting the CSV file.
  • Provide the spreadsheet name from the tile used for uploading the CSV file.
  • Choose the range that corresponds with individual transactions from all the people for whom a report will be created.
An Integromat Google Sheet tile that loads one column to retrieve people’s name for whom an expense report should be created.

Aggregate fields from the spreadsheet & de-duplicate the names

  • Tick only the box where the names are shown (in our case, it is column P in the spreadsheet).
Aggregate the spreadsheet column that contains people’s names. We will de-duplicate their names afterwards.
  • Then create a filter between the Google Sheets and the Array Aggregator to filter out names that are too short (this is to catch out empty records or other non-names).
Filter our anything shorten than 7 characters
  • De-duplicate the aggregated records – use the distinct() function
Filter our duplicate records to get only unique employee names

Find whether a parent Gravity Form has already been created for each employee.

  • Overall view for this mini-section:
Snippet of the part of the Make.com (Integromat) workflow that iterates through every de-duplicated name and checks if a name is found in WordPress and if yes, it checks for whether an existing form is already submitted.
  • The idea here is to iterate through every previously de-duplicated (i.e. unique) name that can be found in the report provided by the bank & to link the name to a WordPress user on our site.
Iterate through each de-duplicated record.
Check if a user is found based on the name.
  • Then add a Router tile and add a ‘Gravity Forms – Make API call’ tile. Configure it to search through a form ID that you can find when you open the Gravity Form in WordPress. Use the following syntax to send an HTTP GET query to fetch the latest forms where field ID no.12 contains the user ID, as we created in step 3 (the form ID and field ID will differ in your case!). The output is always up to 10 latest forms and we will then later search only through the latest one.
  • The syntax of the URL field is as follows:
entries/?form_ids[0]=47&search={"field_filters": [{"key":12,"value":"{{50.id}}","operator":"is"}]}
  • See the tile configuration below:
  • Add a filter to filter out requests where no WordPress user was found (zero bundles):
Do not proceed into enquiring the Gravity Forms API unless a WP user was found.
  • If no record was found in WordPress, then add into the Data Store tile that this was an invalid record. We need to record even the invalid ones for Part 4c when we add the creation of child forms into the same Make.com (Integromat) workflow.
Record into the Data Store that an invalid name was found (into the Employee name field).
  • And here is the related filter rule to go this way if no bundles were found:
Filter specs for when no WordPress user was found.

Submit a parent Gravity form if there is no existing pending one

Overview of what we will be covering in this last sub-section – if a form exists already, we check in what state it is and if not pending, we submit a new one.
  • If a previous Gravity form was found, save its details to the Data Store tile. We will need it later in the next step where we create the child form (individual expenses per parent form).
Details to save into the Data Store when an existing record is found. The Entry ID will appear once you have successfully run the Gravity API tile before.
  • And here is the filter to use to filter out only forms that are pending. Gravity Flow is needed – check the Gravity flow step ID as shown below:
How to find what Gravity Flow step ID you have for the user input step to add expenses into an existing un-submitted expense report.
Go this way in the workflow ONLY if the latest entry is in the state of ‘Pending’ as per its Gravity Flow status.
  • In case a pending form is NOT found, then create the following JSON request:
JSON request that will be used to submit a parent Gravity form using the Gravity Forms API.
  • Do not forget to set a filter to make sure that pending forms do not go this way:
Filter out an existing latest forms that are no in the pending state.
  • Create another custom Gravity API call that will submit the form using the JSON file we just created. Make sure that the form ID matches yours.
Submit a parent Gravity form from Make.com using Gravity Forms API.
  • One might think that this is all we need to do for this part but the truth is that we need to record the entry ID of the newly created Gravity Form. The output of the API request through which we just created it, unfortunatelly, does not include the entry ID. So we will now need to recall the latest entries in the form ID to get the detail.
An HTTP GET API call that will fetch the latest 10 entries for form ID 47 (make sure that you specify your correct form ID from Gravity Forms).
  • Now we have all the info we need – we just simply need to save it in the Data Store.
Save all required details to a Data Store so that we can create the child entries later on!

Make.com blueprint .JSON file

The Integromat scenario can be downloaded below – rename the file to .JSON to import it to Integromat:

Download the Make.com Scenario
Part 4a - Integromat Workflow - Fetch data from FTPS and filter it out
Part 4c - Integromat Workflow - Create child forms in Gravity from Integromat
Back to: Concur Alternative: Import Employees’ Credit Card Expenses to WordPress via an automated bank feed – Gravity Form/Flow & Make.com (Integromat)

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 comment 0 FacebookWhatsappEmail

Concur Alternative: Import Employees’ Credit Card Expenses to WordPress via an automated bank feed – Gravity Form/Flow & Make.com (Integromat)

  • Previous
  • Next
Collapse
Expand
  • Part 1 - What do we want to do + Required technology (bank feed)
  • Part 2 - Design the child form for expenses (Gravity Forms)
  • Part 3 - Design the parent form for individual expenses (Gravity Forms)
  • Part 4a - Integromat Workflow - Fetch data from FTPS and filter it out
  • Part 4b - Integromat Workflow - Submit the parent gravity form from Integromat
  • Part 4c - Integromat Workflow - Create child forms in Gravity from Integromat

Search for articles

Other Tips

  • How to mount an NFS share (such as from FreeNAS) from an Android box
  • How to download a Windows 10 ISO on a Windows device – easy work-around

Other Tutorials

  • Build Your Own Router - Proxmox, OPNSense, OpenVPN server and a VPN client all in one!
    12 Steps
  • Dynamically Populate Gravity Forms from Google Sheets (GSheets APIv4)
    6 Steps

Recent Comments

  • Jan Bachelor on Use Integromat to get computer IDs from user email in JamF ProHi Robert, the static groups were created in the p…
  • Robert Petitto on Use Integromat to get computer IDs from user email in JamF ProCan you share how you'd use Make (integromat) to a…
  • Martin on Part 1 – What do we want to do + Required technology (bank feed)This tutorial deserves more credit, I've not seen…
  • Jan Bachelor on WAN / LAN Set Up (Before OPNSense Installation)Hi Ed, I have not tested it with PCI passthrough y…
  • Ed on OPNSense VM Set UpIn step 4 firewall you turned off firewall, should…

Tags

chrome iso windows

Categories

  • Android
  • FreeNAS
  • Linux
  • Windows

Recent Posts

  • How to mount an NFS share (such as from FreeNAS) from an Android box

  • How to download a Windows 10 ISO on a Windows device – easy work-around

Facebook Twitter Instagram Pinterest Linkedin Youtube

@2019 - All Right Reserved. Designed and Developed by PenciDesign

Bachelor Tech
  • Home
  • Tutorials
  • Portfolio
  • About Jan
  • Contact Jan