cancel
Showing results for 
Search instead for 
Did you mean: 

Insert SQL Server records from public web forms

There are many actions available in Microsoft Flow, including SQL Server actions. In this article, I will create a Partnership Request form with Plumsail Forms, which anyone who is interested in partnership can fill. This information will then be handled by Microsoft Flow and a new record will be added to SQL Server Database.

 

First, we create a form in the designer. Add all the necessary fields, in this case - Company, Name, Email, About and Products the user can be interested in:

 

1_Designer1.png

 

 

We then add new Flow to trigger on form submission and parse JSON from it. Here's how it's done - Creating Flow.

 

After adding Parse JSON action and inserting form schema into it, I click New Step button and search for SQL Server.

Here, I select SQL Server - Insert row:

 

2_sqlServerSearch.png

 

 

Now, if this is your first time using SQL Server actions in MS Flow, you'll need to fill in all the information to establish connection to the database.

 

Connection name can be anything, it's up to you what to call it. Other than that, you'll need to fill in server, login and password, as well as select the specific database to access.

 

Next, once the connection is established, you'll be able to select Table in the database, and then what information to add to what column.

 

We'll add our parsed fields from the form to Company, Name, Email and Comment columns, but it's important not to add multiple choice Product checkboxes straight inside or the action will loop and add a record for each choice made.

 

Instead, we'll use Expression join() and combine all Product choices into one string:

 

3_join.png

 

 

Once I select join() expression, I go back to Dynamic content tab, click Products to insert field inside the Expression and add a divider to fields from one another:

 

4_Products.png

 

 

Final result looks like this and I can save the Flow:

 

5_finalFlow.png

 

 

So, to test the Flow, I will fill in the Form and submit it, here's an example:

6_partnershipRequest.png

 

 

I just click submit and here's the entry in the database from the Flow, just a few seconds later: 

 

7_dbEntry.png

 

 The article was originally published at plumsail.com.

Comments

Thanks so much for always contributing such awesome material to the community! I know i always appreciate your stuff when i see it!

Meet Our Blog Authors
  • Working daily with Microsoft Cloud to deliver the needs of my company, my customers and various Microsoft communities and forums. | Office 365 | Flow | PowerShell | PowerApps | SharePoint |
  • Co-founder of https://plumsail.com, Office 365 and SharePoint expert. Passionate about design and development of easy to use, convenient and flexible products.
  • Microsoft Business Apps MVP. Owner of ThriveFast, an Office 365 consulting company.
  • 7x Microsoft Business Solutions MVP (CRM)
  • I'm keen in MS technologies, SharePoint, Office 365 and development for them
  • Daniel is a Business Productivity Consultant & Microsoft Business Solutions MVP who is very enthusiastic about all things Office 365, Microsoft Flow, PowerApps, Azure & SharePoint (Online). Since the preview, Daniel has been working with Microsoft Flow and later on with Microsoft PowerApps. That led to him being awarded an MVP Award for Business Solutions. He loves to blog, present and evangelize about improving productivity in the modern workspace with these amazing tools!
  • Michelle is an Office 365 solution architect in Twin Cities, MN. She has been delivering business collaboration solutions for years with her focus on SharePoint and Office 365. Michelle is a recent board member of the Minnesota Office 365 User Group and has been a member of the SharePoint community since 2009. She is a frequent speaker at MNSPUG and SharePoint Saturday and co-chaired the Legal SharePoint User Group for 4 years. Her most frequent projects have involved rolling out a large deployment of Office 365, SharePoint Online intranet, build of a "CHAMPS" Office 365 user adoption program and most recently, SharePoint On-Premise to Online Migration. Michelle is very excited about cloud technology as it is shifting her IT Pro focus to collaboration strategy and technical adoption.
  • I'm a Microsoft Office Servers and Services MVP with a special interest in SharePoint, Office 365, Microsoft Flow, Microsoft Teams and PowerApps. I work at Triad Group Plc ( https://triad.co.uk)
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor