FormSync will enable Git tracking for your forms built on the popular Gravity Forms plugin for WordPress. This post explains how to get started syncing your Gravity forms across local, staging, and production environments.
For now, I’ll assume you have a deployment process to push your theme from local to staging/product. Even if you’re just FTP-ing your theme’s files, all that’s needed is to push the updated JSON files where you need them. For the sake of this tutorial, I’ll assume you’re scanning your production forms, and pulling them into a fresh, local installation. Let’s start!
Run an Initial Scan
The initial scan is what’s going to scan all of your forms for the first time. If your forms are all in a production environment, you may want to run the scan on production. Where exactly you run this initial scan isn’t that important, but be aware that it should be where you want to “snapshot” your current forms.
Navigate to your WordPress admin –> Forms. Click the checkbox at the top of the list table to select all forms, or select the forms you want to scan. Select the “FormSync Scan” option, and click Apply.
After running this scan, your active theme will contain a new folder, found at
/formsync/gravity-forms, which will have a JSON file for each form. Pull the entire
formsync directory into your local environment, making sure to preserve the same paths.
Once you’ve pulled in your forms, you can now sync them with existing forms, or create new forms from the JSON. Since I’m assuming a fresh installation, we’ll create new forms.
Next, switch over to the FormSync page in your WordPress admin. Under the Gravity Forms section, you’ll see a list of your forms (from the JSON sources). Click any form to sync, and elect to create a new form.
Your form should now be synced up on your local installation! You can make all the changes your heart desires to the form, and the JSON will be automatically updated. Go ahead and make some changes, then check the form’s JSON file – you’ll see the changes reflected immediately.
Now that you’ve made your changes, it’s time to deploy those changes. Hopefully you have a nifty, Git-powered, continuous deployment in place, but you could even get by with FTP, if that’s how you roll. For now, let’s just say you commit your changes (the changes are made to your theme), push to a Git repository, and trigger the deployment to push your code all over the internet.
Your changes are now pushed out to staging and/or production. Cool. Now let’s go to our production wp-admin, and head over to the FormSync page. You should see the forms you changed are now out of date, like so…
To fix that, click “Sync Form.” Now, since your forms are already in the database (unlike on a fresh installation), you can select a form to which you want to sync the JSON. Select the appropriate form, and click “Sync.”
Your form will sync up with the JSON that you just pushed, and the updates saved to the database – just as if you made the changes directly on production!