I’ve talked about the Log in the History List action when using Nintex Workflow on-premise and how to extend it by building a User Defined Action so that you can log a lot more than what the action allows.
This post is about doing something similar using the Nintex Workflow for Office 365 product.
There are a number of reason why you want to do this in an Office 365 environment. There are times when a Nintex Workflow variable contains a lot of text and you need to see it during debugging. One big reason that I found recently, is where I received some XML back from an action. I needed to pull information out of that XML, but I needed to know the structure of that XML so that I could build up the appropriate XPath expression. Logging the XML itself, was just too big and it was truncated to 255 characters. This is where this bit of workflow logic was born.
The aim here is to take a bunch of text, and break it up into loggable chunks (255 characters) and log each chunk to the workflow history.
eg. if you had to break up a text string in to 5 character chunks then it’ll be like this:
Original Text String : abcdefghijklm
Broken up : [abcde] [fghij] [klm]
The above workflow depicts only a snippet of the actual workflow that is available in the download section. But it shows you the core of what the process logic required for breaking up text and logging each chunk to the workflow history.
To start things off, we need a few variables that are used in this workflow:
These variable are used during the processing of the text. The textXMLData is used to store the text chunk that is going to be logged. The boolContinueProcessing variable is used in the loop to let it know to continue processing and the numTextIndex variable store the position into the original text, where we want to read data out.
The Boolean (yes/no) variable, we need to initialize to Yes so that the Loop action can run.
The workflow mainly revolves around a Loop action that continues to run while there’s data to log.
Inside the loop, we have some logic to pull out the text from the original text, using the Extract Substring of String from Index with Length action:
After that, we also check to see if that variable is then empty. If textXMLData is empty, nothing needs to be logged and we can hop out of the Loop. So if that is the case, we reset the boolContinueProcessing variable to false. This tells the workflow to stop the loop and continue on with the rest of the workflow.
Now this process is ideal for a User Defined Action. UDAs are not currently supported in the Office 365 product. But as soon as they are, I’ll make this in to a 365 UDA.
But when you run a workflow like this and look at your workflow history, you’ll find it looks like this:
Each row contain 255 characters except the last row which is probably less. Hopefully, this helps you think about how to get something like this to help with your workflow design or debugging.
Download the Workflow – Download and import into the Workflow Designer page