Welcome to an article on how to execute SQL in SharePoint 2013 and Office 365 using Nintex Workflows. This article will display the action “Execute SQL” so that all my developer friends don’t have to spend much time and effort while using this function in their projects.
Let’s see the implementation of this functionality.
- Create a list, Dev Testing.
- Click on the List tab on the Top ribbon and click on Nintex Workflows.
Figure 1: Workflow
- You will see the following screen, to create a new workflow.
- Click on “Create new workflow”.
Figure 2: New Workflow
- You will come to the design phase of the Nintex workflows.
- Add the action, “Execute SQL” either by right click on the workflow or by dragging and dropping from the left toolbox.
Figure 3: ToolBox
- Now let’s configure it.
- When you double click on the action the following screen opens up.
Figure 4: Screen
Figure 5: Screen2
Connection String: Here specify the SQL connection string to connect to a remote SQL database.
Query: Specify the SQL Query for 200 records as a result.
Column to retrieve: Specify a column name which you want to retrieve from SQL 'SELECT' query result.
Results count: Specify a variable (Number type) to store the total number of results executed from the query
Retrieved column values: Use a collection or dictionary type variable to store the values of the columns to retrieve from the query.
Results in XML: Use a collection or dictionary type variable to store the query results in XML format.
- Once you have configured your workflow, go and publish it to use it.
- Click on Publish on the left corner of the ribbon of Nintex Designer.
Figure 6: Save
You will see the following screen:
Figure 7: Publish
- Give your workflow a name
- Description
- Choose your task list where it should store the tasks, It will be Workflow Tasks by default.
- Choose your history list where it should store the history logs, It will be Workflow History by default.
- Start Options:
- You can either start your workflow manually.
- Or you can start your workflow automatically when an item is created
- Or you can start your workflow automatically when an item is modified. - Click Publish
- Your workflow will get published.
This action will help us to get values directly from a SQL DB through our query which we can use for various purposes as in updating a value or getting a value and other functions. Hence it will be very important for us sometimes to have this function through Nintex rather than writing code to get values from SQL.
So in this article we saw how to execute SQL in SharePoint 2013 and Office 365 using Nintex Workflows, we will see more new articles on the actions of Nintex Workflows in the other parts of the article. Till then, keep learning.