How To: Create an Outlook Task in a workflow

This topic shows you how to use the Task SmartObject of the Exchange Online Broker in a workflow to create Outlook tasks.

You must activate the Exchange Online feature to create an instance of the Exchange Online service type. See Exchange Online Feature Activation for more information.

The Exchange Task API does not include a recipient value and assumes that the task is added to the current user's Task folder. The example K2 workflow uses the On behalf of parameter to store the email address of the person to impersonate, then calls the Create method using that account.

Using an Order form to create tasks in a users Outlook

Scenario

The scenario below shows you an example of how to use the Task SmartObject's Create method in a workflow. It adds a task to the order packer's Outlook calendar, and uses a SmartForm to gather information about the order and then starts the workflow. In this example the task is added to Chris's My tasks folder in Outlook.

Steps

In the below steps you use the Task SmartObject and its create method to create a view, a form, and a workflow. These allow you to fill in information about an order and start a workflow which creates a task in Outlook.

Setup Steps

The following steps set up the scenario from start to finish. If you want to skip the setup steps and view the topic step, go to Create the Orders Workflow.

  1. Activate the Exchange Online Feature
    1. Before you start creating the Orders view, you must activate the Exchange Online feature.
    2. Once activated, create the Orders view and then add it to a form.
  2. Create the Order SmartObject
    1. In K2 Designer, create a new SmartObject. In this example it is named Orders
    2. Add two properties called Item and Quantity as shown below:
      Order SMO PropertiesTypeKeyRequiredUnique
      IDAutonumberYesNoYes
      ItemTextNoNoNo
      QuantityNumberNoNoNo
    3. Click Finish to save the SmartObject
  3. Create the Orders View
    1. Click Design a new View.
    2. Enter Orders as the name of the view.
    3. Select the same category as the Orders SmartObject.
    4. Select Item View and click Create.
    5. Select Create Labels and Controls.
    6. Select Item and Quantity fields for the layout and select the Create method for the button. Click OK.
    7. Click Finish to save the view.
  4. Create the Orders Form
    1. Click Design a new Form.
    2. Enter Orders as the name of the form and click Create.
    3. Add a title to the form.
    4. Click Finish to save the form.

Create the Orders Workflow

The steps below discuss how to configure the Orders Workflow.

  1. Create the Orders Workflow
    1. Click Design a new Workflow.
    2. Type in a name and click Create.
    3. Configure the workflow's Start rule to run when the Create Button is Clicked. Click Next.
    4. From the left side of the workflow designer, select the SmartObject Method step and drag in onto the canvas.
    5. Select the Task SmartObject from Exchange Online SmartObjects.
    6. Select the Create method.
    7. Expand the SmartObject event configuration and add the On behalf of parameter.
    8. Add Package Order as the Subject for the task. Enter the email address of the person who will package the order as the On behalf of value (the task is created in this person's My Tasks folder). In this example, Chris packages all orders, but you can use someone in your organization or a field in your workflow or environment that contains a valid email address.
    9. Deploy the workflow.
  2. Test the solution
    1. On the Orders form page, click Run.
    2. On the form, enter an Item and Quantity value. Click Create.
    3. The values are added to the SmartObject and the workflow starts, creating a task in Chris's My tasks folder in Outlook.
    4. Log in to Outlook using the account of the person you configured to package the order. The task shows in the Tasks folder.
Review

In this topic you learned how to create a SmartObject, view, form, and workflow that creates a task in the My tasks folder in Outlook.