SharePoint 2013 Hosting :: Using the Log to History List SharePoint Workflow Activity for Debugging

SharePoint 2013 Hosting :: Using the Log to History List SharePoint Workflow Activity for Debugging

Introduction

You can utilize the Log to History List Sharepoint Designer workflow activity to compose messages to the workflow history list while the lifetime of a workflow. These messages can serve as a method to report the status of the workflow back to the client.

You can also utilize the Log to History List Sharepoint Designer workflow activity to debug a Sharepoint Designer workflow or to discover whether a workflow is giving back where the worth you hope it to whilst it’s running.

To explain how you can utilize the Log to History List Sharepoint Designer workflow activity to debug a Sharepoint Designer workflow, consider the accompanying condition…

The Current Item source in a Sharepoint Designer workflow has a few URL fields, for example, Encoded Absolute URL, Path, Server Relative URL, and URL Path that you can utilization. How would you know which URL field to utilize if you don’t know what sort of worths they give back?

A simple approach to figure out what sort of worths the URL fields on the Current Item return, is to make a workflows that contains Log to History List Sharepoint Designer workflow activities for every URL field for which you need to know its return worth.

Using the Log to History List workflow action to display workflow values

To create a SharePoint Designer workflow for testing purposes:

  1. Create a new SharePoint Designer workflow and attach it to a SharePoint document library that contains a couple of documents.
  2. On the Step 1 screen of the Workflow Designer, click Actions, and select More Actions from the drop-down menu that appears.
  3. On the Workflow Actions dialog box, select Core Actions from the category drop-down list box, select Log to History List from the actions list box, and click Add. The following workflow action text appears on the Workflow Designer:
  4. On the Step 1 screen of the Workflow Designer, click this message, and then click the formula button (second button) behind the text field that appears.
  5. On the Define Workflow Lookup dialog box, select Current Item from the source drop-down list box, select Encoded Absolute URL from the field drop-down list box, and click OK.
  6. Repeat steps 2 through 5 to add a Log to History List action for each one of the following fields in the Current Item:
    >> Path Server
    >> Relative URL
    >> URL Path
  7. On the Step 1 screen of the Workflow Designer, click Finish.
  8. Once you’re done creating the sample workflow, go to the SharePoint document library to which you attached the workflow and manually start the workflow on a document in the library.
  9. Press F5 to refresh the contents of the SharePoint page. Once the workflow has run, a column with the name of the workflow and the text Completed will appear in the SharePoint document library.
  10. Click the text Completed to open the Workflow Status page.
  11. You’ll see the values for the URL fields recorded by the Log to History List workflow action listed under the Workflow History on the Workflow Status page.

Showing the values of URL fields utilizing the Log to History List activity

The values for the fields from the Current Item from a Sharepoint file library are listed in the table below for a Sharepoint file library named My Documents Lib and a document named My Doc.docx.

URL Field Name Value Returned
Encoded Absolute URL http://SharePoint_Server_Name/My%20Documents%20Lib/My%20Doc.docx
Path My Documents Lib
Server Relative URL /My Documents Lib/My Doc.docx
URL Path /My Documents Lib/My Doc.docx

The same values for a SharePoint list item named My Item in a list named My List are listed in the table below.

URL Field Name Value Returned
Encoded Absolute URL http://SharePoint_Server_Name/Lists/My%20List/1_.000
Path Lists/My List
Server Relative URL /Lists/My List/1_.000
URL Path /Lists/My List/1_.000

where 1 is the ID of the list item.