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

Question

Question

Workflow sometimes get stuck running a SDK Script

asked on July 20, 2015

We have a fairly basic workflow which determines where a document should be filed away.  Part of the workflow is an SDK script, which is used to help determine the folder path where the document will be filed away, assigning a token value using a set of if/then statements. 

Every now and then, perhaps one or two per thousand instances, the script activity stays in a Running status, and the instance in a Waiting status, until a user catches it and manually terminates the workflow.  At this point, either the user has manually filed away the document, or updated the document which started a second instance which works just fine.

I had read on another post something similar about an SDK script, where it might be an issue with a shared resource.  I've attempted to reproduce the issue several ways, but have yet to be able to reproduce it in testing.

Is there another possible issue that might be causing this type of problem, or a way of getting more information about why it is stuck in a running status?

I've attached the script for a reference.

 

Thank you.

 

1 0

Replies

replied on July 20, 2015 Show version history

Robert,

A few things stick out but I don't think they would cause the workflow to hang.  The first is that your final 'else' clause does not assign a value to the 'Range1' token.  Are you that sure your input token will always fall within the ranges indicated by your if/then/else statements?

Secondly, I would actually instantiate another variable at the beginning to hold the results of the if/then/else clauses and then just before you exit the script I would set the Range1 token to that value (only 1 this.SetToken versus many)

Although the if/then/else clauses will work I would suggest moving to a switch/case/default structure to improve readability.

Finally, I would put the majority of the code in a Try/Catch structure and report any errors thrown to the WorkflowApi.TrackError method.  (Or whatever is equivalent in the version of Workflow you are running)

I don't do C# but would be willing to rewrite in VB if you need an example.

Hope this helps!

1 0
replied on July 27, 2015

Thank you for your advice.  I will see attempt to restructure the statements.  This script was created years ago on an older version of workflow, so it is possible it broke during our recent upgrade.  Or it may have always had issues, and just was never caught because no one kept an eye on things till recently.

 

I will try and come back in a few weeks and update if we've continued to see the issue or not.

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

Sign in to reply to this post.