SharePoint 2013 Designer and Workflow Tips, Tricks & Traps

In this article, I want to share my experience working with SharePoint Workflows via SharePoint Designer. Sometimes it may be very painful, but I hope after reading this article you will not step on the same rake.

Do not log Dictionary variable to Log to History

This is a very common issue, your workflow just stucks in the started state with following error:

It occurs because your data is too big. This workflow action can display a limited number of symbols. Otherwise, such error occurs. As a workaround, you can use Send E-Mail with Attachments (SMTP) action instead of Log to history.

If you send dictionary by email you can receive its structure in JSON format. It is very helpful to understand the structure.

Be careful using Get an Item from Dictionary

Usually, you need to get an item from an array and you use ‘Get an Item from Dictionary’ workflow action like this:

However, please be careful because if you have extra whitespace in the path, your workflow can be stuck into suspended status with the following error:

SharePoint Designer Cache Errors

The following error is very common when you work with SharePoint Designer:

“Failed to Load this workflow. To correct this problem, restart SharePoint Designer.”

To resolve it, you need to clear SharePoint Designer cache

And here is a command for the command line to do it:

Create self-documented workflow using stages

You should know how fast you can forget something that you did some time ago when you are using workflow. Please, try to use correct stage names and divide your workflow into small pieces of actions (like procedures in programming languages). In addition, you can use Add a Comment workflow action to leave additional comments in your workflow.

As an example of a self-documented workflow I can provide a Nootification workflow that is described in another article.

Use Dynamic Value Evaluator to check your expression

It is useful when you use ‘Get an Item from Dictionary’, you can easily check your expression using Dynamic Value Evaluator. For example, you have some data in your dictionary and want to build a path to retrieve it. This is a tool which can help you to do it. Just past JSON structure of your dictionary into a textbox and write your path, then click ‘Run’. It will show what result you can expect.

Lookup User Name/Login/Email by ID

Indeed, this is one of my favorite features, you can use any string variable with an integer value and lookup user data by ID. The example below returns correct display name of the user by specific ID.

You just have an ID, but retrieve a display name.

Get Date in required format

You can use out of the box method as in the figure below:

Additionally, you can use free custom action Format Date from Plumsail Workflow Actions Pack.

Use Requestb.in to check your query

When you use ‘Call HTTP Web Service’ you need to see how your request looks. RequestBin service can help you with that, it just logs all queries and shows them to you.

Use App Step to get access

This is a hard to use feature, but in some situations, it is the only way to get required data. Moreover, you can use app-step to get data (for example via REST request) from another web. To use it you have to activate the feature that is called ‘Workflows can use app permissions’. After that, you need to manually grant necessary permissions to your workflow via AppInv.aspx page. You can find more info on MSDN.

Conclusion

In this article, I have tried to collect most interesting notes, which I hope can save a huge amount of your time while creating your workflows. SharePoint 2013 workflows are quite flexible and allow you to use complex objects and loops, but sometimes they just hit you in the stomach with some non-obvious errors.