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

Question

Question

Hold/Delay/Suspend a workflow until a document is generated

asked on April 28, 2023 Show version history

I am attempting to use Try-Catch for the first time, and I doubt I am using it correctly.

Part of a new onboarding process I am developing for Public Works requires the hiring process "pause" until a candidate signs their confirmation letter.  The confirmation letter is it's own separate process that generates a signed PDF document and drops it into the repository.

What I am trying to do is tell workflow to search the specific repository for a file with the application ID, and "try" to find it.

Search Query:
({LF:Basic~="Signed Confirmation", option="LTN"}) & {[EPG]:[EPG_ApplicationID]="%(TK_ApplicationID)"} & {LF:Ext="*"} & {LF:LOOKIN="Public-Works\Business Services\Employee Onboarding\"}

 

If it fails to find the application (the candidate didn't sign it yet) - the error I get is "The selected entry could not be found [0587-WF1].  At this point, it should "catch" the error and run that branch right?  That branch contains a delay of 1 hour, and then re-run the workflow.  

 

If this is an inefficient way of doing this, please advise.  But from what little I understand about try/catch is that I have it set to "All Errors", so the document not found should trip the catch error.

I do have the forms workflow to wait until this workflow to end before proceeding, but it just blasts on through and sends the status email even after it says it cannot find the file.

 

Thank you in advance.

 

0 0

Answer

SELECTED ANSWER
replied on April 28, 2023

The Search Repository activity doesn't return an error when no records are found, so it isn't going to trigger the catch branch.

Instead it returns a token of Result Count = 0.

So the better path would be to have the Search Repository, followed by a Conditional Sequence that checks for Result Count = 0, and runs the delay there.

I also wouldn't re-start the same workflow, but rather wrap that section in a Repeat Activity that repeats until the Result Count > 0.

It would look something like this:

1 0
replied on April 28, 2023

Ah, that explains the first part of what was driving me nuts.  Thank you for explaining the result count.

 

I will attempt to re-work the process using your tips - thank you.

 

Also, just for my knowledge, why wouldn't you re-run the workflow?  Potential for infinite loop?

0 0
replied on April 28, 2023 Show version history

I wouldn't, because there are activities like "Repeat" that exist, and because there is a ceiling limit on how many times a workflow can recursively call itself.  I can't actually remember what the limit is, but I know I've hit it before.

EDIT TO ADD: I believe the limit is 32 times that a Workflow can invoke itself.  That's based on comments on this post and this post.  And that sounds familar from my own experience.

EDIT TO ADD ADDITIONAL:  The possibility of an infinite loop is the reason the invoke depth limit exists.  Depending on how they are set up, a Workflow infinitely invoking itself could use up all your server’s resources and be pretty difficult to stop, so Laserfiche built a hard stop into it.  
The Repeat activity also has a hard stop built into it in the form of a maximum run configuration, but this can be tweaked on a per-case basis to meet your needs.

2 0
replied on April 28, 2023

Thank you Matthew for teaching me something new today.  This worked exactly as I needed it to and will be very helpful to the process.

1 0
replied on April 28, 2023

So glad it worked for you.

0 0

Replies

replied on April 28, 2023

Why not use a wait condition on the parent folder?

1 0
replied on April 28, 2023

I've attempted to use a Wait for Entry Change, but it too didn't stop the workflow.

0 0
replied on April 28, 2023

What did you set it to?

0 0
replied on April 28, 2023

I set the wait condition to

 

Entry: Field (Signature) is not empty

 

But I don't think it will work because if the document isn't there, it cannot monitor for a change.

0 0
replied on April 28, 2023

Right, you'd need a condition on the folder contents. The criteria for the document's existence should be close to your search criteria.

This workflow looks like it might be started from Forms? So there is not starting entry, which means you'll have to get a hold of the folder where this doc will appear.

 



1 0
replied on April 28, 2023

I've never tried the Escalation item before.  Thank you for posting this.  What Matthew suggested ended up working exactly as I needed, but if I end up needing this again in the future, I might go with what you have suggested.

1 0
replied on April 28, 2023

The escalation is there to keep this from being a "forever" workflow waiting for that one employee who forgets to send their signed stuff back.

I would ask that you consider the number of these documents in flight in your final design. The solution Matthew posted above can be heavier under load because it periodically makes a "are we there yet?" call into the Laserfiche Server. That's not a big deal if you have a few of these active at any given time, but 5 years down the road when you've grown and have 10,000 in flight and they all try to check with the repository every hour, you may notice a performance hit.

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

Sign in to reply to this post.