I have a Workflow that calls a C# script. This script takes anywhere from 4-10 seconds to complete but during this time the Workflow has already moved onto the next step. Is there a way to make workflow wait until the script has completed before it moves on? I'm not wanting to put a delay as the time tends to vary so I am hoping I am just missing an obvious activity or checkbox that enables this.
Question
Question
Answer
Sorry, this thread doesn't quite make sense. Script activities wait for completion/error or for the specified timeout before allowing workflow to move on.
What is your script actually doing?
Replies
You can use the "wait for entry change" activity. Have it wait for a token to be set to a certain value. Set that token value in your script.
You can't set the "Wait for Entry Change" on a token. I would have to set it to watch for a change in the document (e.g. Template Field, Tag, ...) and then add an activity to remove that. I'd thought of that option but it just seems like a simple option to have Workflow "Wait for Script to Finish" like it does for queries and invoked workflows. I was hoping someone had an out-of-the-box option.
A workaround is have your script add a field that that the wait for entry change can monitor
That is what I figured I'd need to do but it is quite a work around for this limitation. Does Laserfiche plan to add this functionality in a future version of Workflow and if not can I get it added to the wish list?
That's what I thought too because I know I've used scripts before and they've waited but it's been a bit since I last wrote one so I thought I was missing something. I had several other people review the workflow/scipt (looking for a stupid mistake) and finally just started the workflow over from scratch (this was an imported workflow that I added the script activity to). The script activity is working as desired now so I am just chalking it up to either a stupid mistake I didn't recreate when I rebuilt it or a bug in a workflow built many versions ago and migrated many times. Either way, you are correct Miruna, Laserfiche does wait for the scripts and it is working properly now. Thanks to both you and Xavier for the help.