10. Configure the Delete Site Outcome
In this step, you complete the Delete Site steps. For this outcome, you add a Delete Subsite step, then update the site status column. Because the subsite no longer exists, you also edit the Link to Site column and add a note that the site is no longer available.
- From the Toolbox > SharePoint > Sites node, add a Delete Subsite task to the Delete Site outcome. For the Pick Site value, select the root site collection. (If you selected your subsite as the location for your new site, select the subsite.) Add a Filter and configure it so that ID equals the reference: New Site > ID.
- From the Toolbox > SharePoint > Sites node, drag a Delete Subsite step so that it aligns with the Delete Site outcome. Connect the outcome to the new step.
- Select the Delete Subsite step, then expand the Configuration Panel. For the Pick Site value, use the drop-down to browse to your root site collection. If are working in a K2-provided VM, the site collection is portal.denallix.com. If you are working in your own environment or cloud environment, browse to and select the root site collection. (If you built the new site in your SharePoint subsite, select the subsite instead of the root site collection.)
- Next, you need to specify which site in the site collection K2 should delete. Click Add Filter, then expand the Context Browser.
- First you select which property to base your filter on. From the left-side drop-down, select ID. Now you need to map this property to a value in the Context Browser. In this case, it's the ID for the New Site reference. In the Context Browser, under the REFERENCES heading, expand the New Site reference. Drag the ID reference into the text box. The operator (=) is fine as is. Collapse the Configuration Panel.
- From the Toolbox > SharePoint > Sites node, drag a Delete Subsite step so that it aligns with the Delete Site outcome. Connect the outcome to the new step.
- To complete the Delete Site outcome, you update the Site Status and Link to Site columns. Copy, then paste, the Set Status Site Created step on the design canvas. Align the step with the Delete Subsite step, then connect the two steps. Edit the new step. Change the Site Status value to Site Deleted. Remove the value from the Link to Site text box. Since the site no longer exists, the link is now invalid. Delete the Site Created On property. You do not need to update this column. Rename the step to Set Status Deleted.
- Copy, then paste, the Set Status Site Created step onto the design canvas. Move the new step below the Delete Subsite step, then connect the two steps.
- Select the new step, then expand the Configuration Panel. Under the PROPERTIES heading, change the Site Status to
Site Deleted
then delete the value in the Link to Site text box. Since the site no longer exists, the link is invalid. Delete the Site Created On property. - Click the Properties tab. Change the step name to
Set Status Deleted
then collapse the Configuration Panel.
Your workflow should look similar to the image below.
- Copy, then paste, the Set Status Site Created step onto the design canvas. Move the new step below the Delete Subsite step, then connect the two steps.
Review
In this step, you configured the Delete Site steps for the workflow. You added a Delete Subsite step and configured it for the New Site subsite. You created the New Site reference in a prior step. Because K2 keeps track of reference values, it knows which subsite to delete by this reference. You completed the outcome by updating the Site Status and Link to Site columns so that they reflect the deleted site. In the next step, you complete the Keep Site steps.