Rock U - Workflows - Persisted Workflows
Transcribed Video Content
Okay. So let's talk about persisting workflows. And again, when you think about the term persisting, you can almost substitute the word save. At what point do you wanna save your workflow and how do you wanna save your workflow? And that's the key topic for this video.
And you might be wondering, don't you always wanna save a workflow? And and the the case is not necessarily. If you have a lot of workflows that launch from maybe, the change of an entity, so you can do a trigger on an entity to say every time a person is saved, run this workflow. You may not wanna save each instance of those workflows. It can cause a lot of slowness on your system and it also puts a lot of data into the database that simply isn't needed.
So let's look at a few use cases on persisting workflows. The first step or the first option is to persist from the beginning. And there's a setting on the workflow template when you're creating it to actually do this for you. So it determines whether it should always be persisted. So that's one option is to always save your workflow as it's running.
Another option is to have an action save it later. So it might be that you want to persist that yourself. You'll decide when you want to persist it. You might be thinking, when would I do this? So consider the position approval request.
If we persisted it from the first step, from the first time it was launched, when someone went to that request and and just clicked on it and they got the first form, that workflow's already been persisted. It's already has a a entry into the database. And it might be that that person just clicked on it just to look at what fields are available or or simply what was even that workflow doing. At that point, they might abandon the form and never fill out anything. But you would still have a record of it in the database which is not what you want.
So typically, if you have a user entry, you'll persist your workflow yourself in an action after the first, user entry form has been submitted. That way you don't get a lot of, unneeded blank workflows created. Or you could choose to, again, never persist it. So as you're writing this workflow, you might choose to persist it as you're developing it. But if you don't need those end results in the end, if if the workflow just kind of does what it needs to do and it's done and you never need to see a record of it, you might choose to never persist it.
Remember, persisting a workflow or saving it the instance of the workflow is a performance hit on your system. Now, it's not huge but when you have hundreds or maybe even thousands of these launching that can have an effect on your system. So persisting not persisting your workflow at all is something you should consider if it's not needed. So those are your options as you look at persisting workflows within Rock.