Featured Add-Ons -

Transfer File Uploads from Gravity Forms to SharePoint with Power Automate

the Gravity Forms community By the Gravity Forms community Published April 26, 2022

Power Automate

Written by Heidi Neuhauser from Reenhanced…

The Power Automate Add-On for Gravity Forms connects your form submissions to Microsoft Dynamics, Outlook, SharePoint, Excel, and over 650 other services through Microsoft Power Automate.

Microsoft’s Power Platform is one of the world’s leading low-code/no-code platforms with over 20 million monthly active users and with this plugin, your Gravity Forms submissions can be a valuable part of your automated business processes.

Note: Power Automate Add-On is a third-party community add-on. Gravity Forms does not offer support for this plugin, nor is this article intended to be a Gravity Forms endorsement of this plugin, its developer, or quality of support.  As always, we recommend you extensively evaluate all plugins to ensure their suitability for your purpose.

Getting Started with Gravity Forms Submissions in Power Automate

Let’s write a flow in Power Automate. This flow will move a file upload from your Gravity Forms submission into SharePoint. To do this, we’ll use a few connectors in Power Automate:

Here is the full Power Automate flow we will build in this article…

Whole Flow

Need a starting point or want to follow along with your form? Use this Power Automate Template to get started!

Overview of the Process

When we plan out our flow, here are the steps we will take:

  • Using the Gravity Forms Power Automate trigger When a File is Submitted, we kick off our automated cloud flow.
  • Add a Condition to check if the file has value. We’ll use the condition File is not equal to ”.
  • Add the HTTP connector to GET the file.
  • Finally, add the SharePoint action Create File and specify your site address, folder path, file name, and file content.

Trigger: When a Form is Submitted

For our trigger, we add When a Form is Submitted from Gravity Forms. Select the form from Gravity Forms for the flow:

Form Submission Trigger

Actions: Condition, HTTP & SharePoint

Condition

Next, we want to add a conditional. Not every form submission will have a file, and we only want this flow to fire if there is an attachment. The field on my form that collects the attachment is labeled File. I don’t want to take any actions if there is not a file submitted with the form.

In the Condition, I add the File field from Gravity Forms, select is not equal to and create an expression in the Choose a value box that is equal to ” (to capture null values).

Condition

Since I don’t want any action when a form is submitted without a file, I can focus all actions only in the If yes part of my condition.

HTTP

In the If yes box below my Condition, I need to add the HTTP connector (which you can find in the Built-In operations area highlighted below).

HTTP Connector

Select the HTTP connector highlighted above.

In the available actions, choose HTTP:

HTTP

For Method, select GET. For URI, select the File field from the Gravity Forms trigger. The HTTP action step for this flow:

Gravity Forms File Field

SharePoint

Below the HTTP action, add another action. Find the Action named Create File in the SharePoint connector. Then, select from your Site Addresses and specify a Folder Path:

Sharepoint

Everything has been fairly simple up until now…. and now we need to call in an expert to assist with some expression writing. We want the File Name field in SharePoint to match the file name itself. With a little help from expression master Nick Hance at Reenhanced, we are getting the file name and automatically mapping it into a SharePoint list.

So grab your handy developer and ask for some assistance in using your expressions! Here’s the detail of the expression we used in the File Name field in the SharePoint step. You can re-use this general format, but the triggerOutputs part is unique and dynamic to this flow.

last(split(triggerOutputs()?[‘body/15’], ‘/’))

The data comes from Gravity Forms as a string like https://www.reenhanced.com/file.txt. We use the split expression to turn that string into an array like [‘http:’,”,’www.reenhanced.com’, ‘file.txt’]. Then we use the last expression to grab only the last entry in the array, giving us file.txt for the filename.

Need help building expressions in your flows? Check out this handy reference guide from Microsoft!

To build this yourself expression yourself:

  • Click in File Name on the SharePoint action and then click the Expression button.
  • Then, enter last(split( and scroll down in the dynamic values list below the formula editor.
  • Select the file field from your Gravity Forms output
  • Then enter , ‘/’)) to complete the expression

Finally, we need to pull in File Content from the HTTP action step above, so pull in the Body from Dynamic content. Your full SharePoint action should look like this:

Sharepoint Action

Save, Run Flow Checker & Test!

Now that you have added all of the actions to this automated cloud flow, it’s time to Save, run the Flow Checker, and Test your flow to make sure it’s working as expected! Happy building! If you have questions or need help, feel free to reach out and email me at [email protected].

Video Walk-through

If you’re a more visual learner and prefer YouTube videos, here’s a 6-minute video I made to demonstrate building this flow for Gravity Forms and SharePoint:

Ready to learn how to get started using Gravity Forms for Power Automate? Check out this YouTube video that has a complete walk-through on how to set up the connector in WordPress:

 

Gravity Forms Power Automate Connector

You can sign up to use the Gravity Forms Power Automate connector here, for just $199 a year for unlimited flows. Connect your Gravity Forms to over 670 services using Power Automate. This is the official Power Automate connector for Gravity Forms integration.

The quickest, easiest, and only way to officially integrate your Gravity Forms submissions into Power Automate. This plugin maps your form submissions to dynamic fields you can use in any flow.

Money-back Guarantee

Reenhanced is so confident that you’ll love building flows with your Gravity Forms forms that we offer a 60-day no questions asked money-back guarantee. If you are unhappy with this plugin for any reason, contact us for a full refund.

About the Contributor:

Heidi

Heidi Neuhauser is Partner at Reenhanced and a Microsoft MVP for Business Applications. Beyond Dynamics 365 and the Power Platform world, she has two smart, wonderful daughters, a brilliant husband (who owns Reenhanced and authored the Gravity Forms for Power Automate connector) four cats, a Pomsky and a cockatiel, and loves running.

 

Gravity Forms Newsletter

If you want to keep up-to-date with what’s happening on the blog sign up for the Gravity Forms newsletter!