How to: Use Microsoft Power Automate to start a workflow when a SharePoint list item is created

You can use Microsoft Power Automate to start a K2 workflow from a Microsoft SharePoint action. In this article you create a SharePoint list, appify it to integrate with K2, then configure a flow to start the list workflow and send content from the list to the workflow using a data field.

Microsoft Power Automate starts a K2 workflow when a SharePoint list item is created

See the following resources for more information:
The screenshots and instructions for third-party software are accurate at the time of writing. Third-party vendors may have changed or updated aspects of their systems (such as user interfaces, functionality, and security). As a result, this content may be outdated.

Scenario

You want to use Microsoft Power Automate to start a K2 workflow when a new item is added to your Employee SharePoint list. As part of the flow you want to send the employee name from the list to your workflow.

Steps

You create a SharePoint list for your Employees and define columns for Title and Employee Name. When you appify the list for K2 you create SmartObject, SmartForms, and a workflow. You configure the workflow to start manually, and create a variable to receive the Employee Name from Microsoft Power Automate. Then you configure your flow to start the workflow when a new Employee list item is created.

Before You Begin

If you have not done so already,

Setup Steps

The following steps set up the scenario from start to finish. If you already have your Employees list in SharePoint and want to skip the setup steps and view the topic step, go to Step 5: Create a Microsoft Power Automate flow using the SharePoint When item is created action to start the Employee Approval workflow.

  1. In Microsoft SharePoint create a new custom list called Employees.
    1. In Microsoft SharePoint, click Add lists, libraries, and other apps.
    2. Select Custom List.
    3. Specify Employees as the name.
    4. Edit the list properties to add Employee Name as a single line of text.
  2. Appify your list and create SmartObjects, SmartForms, and a workflow.
    1. Select the K2 > Application icon from the SharePoint list menu.
    2. Click the check boxes to Create SmartForms and Create Workflow along with the SmartObjects for your list.
    3. Change the Workflow Name to Employee Approval. Select When the following events occur > Workflow is manually started.
    4. Click OK to continue.
  3. In your workflow, add a Task step with two outcomes, Approve and Reject. Complete the Task step by adding and connecting a Decision step.
    1. In K2 Designer, drag and drop a Task step onto the design canvas.
    2. Expand the Task pane on the right.
    3. Specify Select approve or reject as the Instructions. Click Both in the Actions area to create Approve and Reject actions.
    4. Drag and drop a Decision step to the design canvas. Connect it to your Task step.
  4. Create a Variable to store the employee name. Add Email steps for the approved and rejected action paths. Configure the emails and use the variable in the email body.
    1. Expand the Context Browser. Click the Add link in the Variables area.
    2. Specify Employee Name as the variable name and leave Text as the data type.
    3. Drag and drop Email steps onto the design canvas and connect them to the Approved and Reject decision paths.
    4. Configure the email of the approved path as shown below:
    5. Configure the email for the rejected path in a similar manner, replacing approved with rejected.
    6. Click File. Click Deploy.

Create a Microsoft Power Automate flow that starts a K2 workflow when a new item is added to the Employee SharePoint list.

  1. Create a flow using the SharePoint When an item is created action to start the Employee Approval workflow.
    1. In Microsoft Power Automate, click Home and select the SharePoint popular service.
    2. Click When an item is created.
      .
    3. Select your SharePoint site in the Site Address drop down (this shows if you already have a connection to Microsoft SharePoint in Microsoft Power Automate), or copy and paste your SharePoint site address, such as https://yourcompany.sharepoint.com/sites/sitename.
    4. Select your Employees SharePoint list in the List Name drop down.
    5. Click + New Step.
    6. Specify K2 in the action search bar, then click the Start Workflow action from your K2 Connector.
    7. Select your Employees Workflow from the Workflow drop down. If you have not configured a K2 Workflow connection, complete the connection settings to create one and then make your Workflow selection.
    8. Select the folio field. Select the Expression tab and scroll down to the Date and time section. Click uctNow() and click OK. This sets the workflow folio to the time value when this flow starts the workflow.
    9. Click Show advanced options. Select the Data Field: Employee Name field. Scroll down the Dynamic content list and select Employee Name from the SharePoint list content. Click OK. This sends the employee name content from your SharePoint list through to the workflow.
    10. Rename your flow to K2 Employees Workflow Start.
    11. Click Save to complete your flow.
  2. Test your flow by adding a new employee to your Employees SharePoint list.
    1. In your SharePoint Employees list, add a new employee.
    2. In K2 Management site, select Workflow Server > Workflows > [your SharePoint list] > Employees Workflow.
    3. You should see an instance of your workflow, showing that your flow succeeded in starting a new workflow when you added a new employee.
Review

In this article you create a Microsoft Power Automate flow that integrates with a K2 workflow using a SharePoint When item is created action. Your flow starts the workflow and sends data from the SharePoint list to the workflow's data field.