8. Add a Create Subsite Step; Update Site Requests Columns

In this step, you begin configuring the steps for the Approved outcome. You add and configure the Create Subsite step, then reuse an existing step to update the site status.

  1. Begin by adding and configuring the Create Subsite step.
    From the Toolbox > SharePoint > Sites node, add a Create Subsite step and connect it to the Approved outcome. Configure the details as follows:
    • Pick Site: This is the location where the new subsite is built. If you are working on a K2-provided VM, select portal.denallix.com. If you are working in your own environment or a cloud environment, select the root site collection.
      You can also use your subsite as the location if you prefer.
    • URL Name: You want a unique URL name to avoid conflicts with other sites. Open the Workflow (tab) > Workflow node. Use the ID for the URL Name.
    • Site Template: Select Team site (no Office 365 group) for the site template.
      Depending on your environment, you may see different template options than the image below. Some site templates may not be compatible with your SharePoint build version. You may see workflow errors if you select a template that is not compatible with your environment, K2 version, or SharePoint build version. Select a different team site template if you encounter errors.
    • New Subsite: Provide a title and description for the subsite. Use Context Browser > Site Request references for the values.
    • Reference: Create a reference to the new subsite and name it New Site.
    • Your completed subsite details should look like the image below.
      Subsite Settings

    1. From the Toolbox > SharePoint > Sites node, drag a Create Subsite step so that it aligns with the Approved outcome. Connect the Approved outcome to the Create Subsite step.
      Adding a Create Subsite Step
    2. Select the Create Subsite step, then expand the Configuration Panel. Configure the details as follows:
      • Pick Site: This is the location where the new subsite is built. If you are working on a K2-provided VM, select portal.denallix.com. If you are working in your own environment or a cloud environment, select the root site collection. (If you created a subsite in SharePoint, you can select that as the location as well. Double-click the root site name, then select your subsite.)
        Pick Site
      • URL Name: You want a unique URL name to avoid conflicts with other sites. One way to accomplish this is to use the ID of the current workflow instance. Expand the Context Browser, then click the Workflow tab. Expand the Workflow node, then drag the ID into the URL Name text box.
        URL Name
      • Site Template: The site template tells SharePoint what kind of site to build. Use the drop-down list to select Team Site (no Office 365 group).
        Depending on your environment, you may see different template options than the image below. Some site templates may not be compatible with your SharePoint build version. You may see workflow errors if you select a template that is not compatible with your environment, K2 version, or SharePoint build version. Select a different team site template if you encounter errors.
        Team Site Template
      • New Subsite: Provide a title and description for the subsite. Under the New Subsite heading, click Add (+). CHECK the boxes for both the Title and Description columns. Drag the Title and Site Description properties from the REFERENCES node into their respective text boxes.
        Site Properties
      • Use Subsite Later: Create a reference to the new subsite. K2 creates a "shortcut" to the subsite properties and makes them available for use in other workflow steps (for example, the link to the new subsite). Under the USE SUBSITE LATER heading, click Create, then change the name to
        New Site
        into the reference text box.
        Create Reference
      • Your completed subsite details should look like the image below. Collapse the Configuration Panel.
        Create Subsite Configuration
  2. Next, you want to update three columns in the Site Requests list: Site Status, Link to Site, and Site Created On. Copy and paste the Set Status Pending step once again. Align it with the Create Subsite step, then connect the two steps. Edit the step as follows:
    • Site Status: Change the value to Site Created.
    • Add the Link to Site property: For the value, expand the New Site reference in the Context Browser. Use the URL from this SmartObject reference for the Link to Site value.
    • Add the Site Create On property: For the value, use the Now() function (from the Functions tab) to set the create date to today's date.
    • Change the step name to Set Status Site Created.
    1. Once again, you reuse an existing step.
      Copy the Set Status Pending step (Home > Copy). Paste the step on the design canvas, then move it below the Create Subsite step. Connect the two steps.
    2. Adding an Update List Item Step

    3. Select the Set Status Pending step, then expand the Configuration Panel. Under the PROPERTIES heading, change the Site Status value to
      Site Created
      then click the Add(+) icon. Add the Link to Site and Site Create On properties.
    4. Update List Item Configuration

    5. Set the values for the two new columns. For the site link, expand the Context Browser. Under the REFERENCES heading, collapse Site Requests. Notice the third reference called New Site. This is the subsite reference K2 created in the steps above when you created a new reference. Expand New Site. Drag the URL reference into the Link to Site text box.
      Relative URL
    6. Next, you set the Site Created On value with today's date. You can use a function that calls the current date at runtime. Click the Functions tab at the bottom of the screen. In the Search Items box, enter
      now
      then select the Now() function when it appears. Drag it into the Site Created On text box.
      Search Functions
    7. You can find many different functions out-of-the-box. Functions perform calculations, manipulate data formatting, perform date conversions, and much more. If time allows, delete your search entry to reset the tab, then explore the options found in the Functions tab.
      Functions
    8. Finally, rename the step. Click the Properties tab. Name the new step
      Set Status Site Created
      then collapse the Configuration Panel.
      Setting the Step Name and Label
    9. Your workflow should look similar to the image below.
      Site Request Workflow Partial Four

Review

In this step, you added and configured the Create Subsite step. You used the Workflow ID as the site URL, because the ID is always be a unique value. You reused an existing step to update the site status, then added two additional columns to update: Link to Site, and Site Created On. In the next step, you add and configure a task step for the originator. The originator must decide to keep or delete the new subsite.

Next Step: 9. Add a Task Step to Keep or Delete the New Site