You are viewing limited content. For full access, please sign in.

Question

Question

Workflow Script Action

asked on January 22, 2020

Is there any way by which we can debug the code written in the script workflow action?

0 0

Replies

replied on January 22, 2020

Debugging and trouble shooting the Script Activities in workflow is a bit difficult.  I have found using Try - Catch blocks with a WorkflowApi.TrackError() function in the catch helps.  This will report the exception message back to the Messages tab of the Workflow instance detail.

Try
    ' Do Work ...
Catch ex As Exception
    WorkflowApi.TrackError(ex.Message)
End Try

Usually for more complex code, I will start by developing the code in Visual Studio and then move it into Workflow after I have the code working properly.  I still sometimes have to adjust the code in workflow, but the logic is known to work, so it is easier to tweak and make work.

1 0
replied on January 22, 2020 Show version history

Another thing I often do, although it is not really the "cleanest" way to debug is to add MsgBox() calls in the C# code and run it from the designer.

For example, I will add a try-catch and use the message box to display an error message in the catch block like MsgBox(e.Message).

Additionally, I might add MsgBox() at various points in the code to display the current value of variables to verify them or just so I can "follow" it through the process and see what gets done before it hits an error.

Another benefit is that the dialog window effectively "pauses" the script execution so I can use that to stop at certain points and evaluate the code before allowing it to proceed.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.