Rock U - Workflows - Deconstructing a Sample Workflow
Transcribed Video Content
Okay. So let's dive a little deeper into workflows by deconstructing one of the sample ones that comes out of the box. So to get to edit a workflow, we'll go under admin tools, general settings and configuration, workflow configuration. In this case, let's look at the position approval that we looked at in a previous video. Again, if you want a good overview of a workflow, just open up this activities and it'll give you a nice outline.
In this case, let's actually dive into it and see what we can learn. Okay. Let's open up the details panel and this is where we're gonna see some of the general, information about the workflow type. So its name and its description. I would highly recommend that you provide a long and detailed description here especially if there's any unique requirements of the workflow.
This is a great field to use to put in any requirements that you were handed to kinda keep those requirements with the workflow. Also workflows can be active or workflow templates can be active or inactive and determine if you wanna automatically persist or if you wanna do that yourself. And we'll look about, as we get deeper into this, why we're not automatically persisting this. Some cases you always want to do this. In this case because we have a user form and we don't want to persist or save the workflow instance until someone's actually completed a form, we're actually gonna choose to do it ourselves later.
Also, as you go through your workflow that there's a this concept of a workflow term and the default is a workflow or a request, but we're gonna actually customize it to call call ours a position request. So this is the term that you'll refer to this workflow instance by. Workflows also have numbering. So each workflow instance will have its own number. Each workflow of a specific type starts with its own counter.
So all the position requests will have 12345. If you have a different workflow type, it'll have its own number too. You can choose to put a prefix in front of that. So if I wanted to put, my PR zero zero one, this will give me that prefix. It's good to keep your workflows in categories.
You're gonna see in on the entry that the category actually does help you build user interface for submitting workflows. And so having a nice category structure will be very helpful to you. Next up is the processing interval in minutes. So this is how many times or how often the workflow engine should come to your workflow if it's in an active state and run it to make sure that nothing needs to happen. So in this case, we're saying zero because our whole workflow is pushed ahead and and moved ahead by user input.
So really, we don't need the workflow engine to come back through here and tell us to keep checking on it. But in certain cases, will need that. And so you just put a healthy number in there. You don't wanna make it too small because in the workflow engine is doing a lot of work because you could have hundreds of these workflows running at any given time. But also don't make it too long.
A nice icon font helps distinguish your workflows too in in the user interfaces as you're processing it and administrating it. And lastly is a logging level. So this is another thing that you really want to think about from a performance perspective. It might be that you want the most detailed granular logging which is action to start with. And as your workflow is starts running smoothly and and you don't really need to keep your eye on anymore, you might want to move it back down to none.
Logging is a performance hit and it also can generate quite a bit of data into your database. So we would recommend that you, , started action when everything's working then move it down to none or maybe just to workflow. But typically none is what you'd want. Next, let's go ahead and fold this up and keep things neat. Next is the attributes.
Okay. So these are all the workflow attributes that have been defined. If you've been through the walkthrough we did of this workflow, a lot of these will make sense to you. The requester, position title, the type of position, full time or part time, the number of hours, which really is more related to the part time. And job description is actually a file that the person can upload.
But we're only gonna require this if this if it's full time position. Okay? So some of these are we'll see these in use a little bit later. Okay. So let's roll that up.
Next, we see our activities. Now, the one in green means that this is an activity that's gonna be launched with the workflow. Okay. So as we add activities, we can choose whether they get activated with the workflow or not and when they are, it turns green. So here we'll give our activity a name or a title and a description.
And again, future self will appreciate a nice description here of any kind of logic or specific requirements that you that you might think is obvious right now but may not be entirely obvious later. And then if that activity has any attributes, they'd be here. This is more of an advanced concept but just keep in mind that you can have attributes on the activity and that data would be specific to this activity. Okay. So now we're jumping right down into the actions.
And remember, when the workflow is launched, this activity will be launched because it's activated with the workflow. And so, it's just gonna start at the top of these actions and work its way down until it can no longer until one of these actions no longer it doesn't complete or there are no more actions. Okay. So the first thing we're gonna do is we're gonna show a user entry form. Okay.
So this is the initial form. And note that we've put a nice header here that's personalized. So whoever's logged in, it'll say their name. And here, we're gonna show some attributes. So on a form, basically, you're just showing attributes and you determining whether those attributes should be visible on the form, whether they should be editable on the form, and whether they're required.
Okay. So it's up to you just to kind of pick your attributes and decide on which form you want to show them. Now, they're in order by the order that you provided them, but you can actually switch the order if you'd just by dragging and dropping them above or below. Okay. So in this case, we're just gonna ask for the position title, the description of the position and its type.
Is it part time or full time? Okay. Down below in the form, we're just gonna have we have the ability to put buttons. So I'm just gonna put one button here, it's called submit. And the button type, all it does is it it determines how the button looks.
So primary would be an orange. Secondary would be more of a gray. You have a deny would be red, approve will be green. And these two actually have little icons next to them. Success is green with no icon.
Info would be a blue. Warning is a yellow. Danger's red. Default would be a gray and as would cancel. And you can define these buttons and what they look and they're just a defined type that you can go and find and you can even add your own if you'd .
Okay. The next setting on a button is what activity should it activate. So if I push the submit button, what new activity do I want it to launch for me? In this case, I don't want it to do that. I just want it to continue going down my actions and I'll take care of launching activities myself.
And the final setting here is what response text should be shown after the user hits my button. Now, this text won't always be shown. It'll only be shown if there's not another form that gets created after it. Okay? So if you're gonna put two forms together, it's just gonna go one form to the next form.
It's not gonna show this until there's no more forms to show. Okay? If I wanted to, could create new buttons. I could create several buttons and they could launch different act activities. And if I did have several buttons and I didn't want to launch activities, I could give it an attribute and whatever button I pushed would go into this attribute.
Okay. So that's our initial form. When I work with workflows, I to kind of keep things nice and neat because it can get overwhelming if you don't. So I'm just gonna fold up that action and and, keep it nice and clean. So, our next action is to persist the workflow.
Okay. So, at this point, the users entered one form. So, I know I have some information here. And now, I'm gonna save the workflow. This is helpful again because someone might come to my form and never fill it out.
They don't hit the submit button. They just look at it and go, , I'll come back and do this later. And I really don't want to save a workflow that has nothing on it. So this is actually gonna do the save for me. So this is gonna say persist workflow.
And you set the action type here. It's a little picker and there all the actions are in categories so you can kind of find what you need. Now, this action has one setting. Is this persistent immediately? And I said no.
So what this is saying is , persist this workflow but don't do it until I've run through all the actions and and an action says it it can't complete yet. I could say persistent immediately which says stop everything, save it right now. And once a workflow is set to be persisted, it's always gonna be persisted. So I don't have to worry about always persisting it. I have to keep calling this action several times.
Once I call persist workflow, it's now a persistent workflow and it'll auto save from then on. Okay. Next, I'm gonna set the requester. So I know who the current person is. They're logged in right now.
And I want to set that that current person to the person attribute of requester. So again, there's a nice action called attribute set to current person. And I'm just gonna do that. So the current logged in person will be put into the requester attribute. Okay.
Another one that's just kind of nice. I'm just gonna set the position title and I'm gonna do that in one of two ways. I can either type in the title and know that this this entry supports Lava, I could put a little Lava expression in there or I could just write text. But instead, I'm gonna choose to use the the title to match the position title that the person typed in. So if they typed in event coordinator, the title of the workflow will be event coordinator.
But I could get fancy and type a Lava expression in there if I wanted to. Okay. So now I have the first entry form. I've done some house cleaning there just setting the workflow name. And now I get to this one, get full time details.
Okay. So this is gonna be another user entry form. But note that this little yellow here tells me that there's a filter on this. So it's only gonna run this action if a certain condition is true. So it's only gonna run if the type, if the position type is equal to full time.
So if it's not equal to full time, it's gonna skip this action. Okay? But in this case, it's just gonna go back and put up another entry form. And note here, I'm providing a nice little instruction saying, hey, since this is a full time position, please provide the job description on the official HR template which can be found at this link. Okay.
So now, note, I'm not gonna let them edit the text that they already typed in there. I just don't want that. They've typed it in. I don't need to stress them out by putting it out there again. Instead, I'm just gonna make the job description visible, editable, and required.
Okay. So it's gonna make them upload a document. Okay. So below that is another, action and note that it is also filtered. So let's take a look at this one.
So it's only gonna run again if this is full time And it's gonna set an an the value of an attribute. In this case, the number of hours to forty. Okay. So it's full time. We know it's forty.
So let's just auto set that. We don't need to ask for that. Alright. Another action pops up here and it's gonna say, hey, only do this action if it's part time. Okay?
So this should be pretty obvious. What we're gonna do here is we're just gonna ask for the number of hours from the requester. Okay. And if I go down to the bottom, nothing fancy here. We're just having the same thing, not activating an activity, just gonna keep doing that ourselves.
Okay. Now, the last action. This is gonna send it to HR for additional fields. And now, this this is where we're gonna actually activate another activity. And so what act activity?
The HR activity, which happens to be right below it. Okay. So we've we've finished getting all the information from the user. So now we're gonna go activate another activity. Okay.
So let's go ahead and fold this up just to be neat and clean. And let's look at this HR entry. Okay. So the first thing we're gonna do is we're gonna assign this activity to a person. Okay?
So in this case, we're hard coding that assignment. Now, why do we assign activities to people? That's so that when we get to a user entry form and we need to notify them that we're waiting for them, this is the person that we're gonna notify via email. Okay? So we have a couple options.
Here, we're assigning the activity to a person. Note, you can assign the activity to a group and they'll all receive the email. You can also assign the activity to a security role if you'd . Now, this is gonna allow us again to send that email that says, hey, we're waiting for you. If we didn't do this when we got to the user entry form, we would just be waiting for them, but they wouldn't know.
And perhaps they wouldn't even have, security rights to edit that form. So it's important in cases this that we assign the activity to either a person or to a group. Okay. So now that we've assigned it, we will show our form. Now note here at the very top, we have a notification email.
And then and by providing this template, it's gonna actually send the email for us. Now, you can provide your own your own email template, but really this this default one out of the box, it pretty much works. It's it's very powerful, has a lot of settings and a lot of logic in it that's gonna be pretty much do exactly what you want. So you don't necessarily have to create more of these. Okay?
And include actions in the email determines whether the little buttons at the bottom should be there. Now, you might say include actions in the email and the actions aren't there. That's because there's a required field on your form. So we we can't really even show them even though you've asked for them because we need some information from them. Okay?
So and again, here we're just gonna show a few of the values of the few fields that Ted's entered or the entry requester has entered. And then we're gonna ask for salary range and then who's gonna approve it. Now note here, we're we're actually kind of done. we don't need to do anything else. So in this case, we've chosen to actually activate the the approval process.
Now, we didn't we don't necessarily have to do this. We could just leave this blank and then put another action down below it which would activate, the same approval process, which is right here. Then this case, it's just a little bit of a shortcut. How you do it is completely up to you. Okay.
Let's fold this up to be nice and clean. Oops. We need to get to the approval process. Okay. And this is gonna be very similar to the other one.
In this case, we're gonna assign the approver. And notice this case, we're not hard coding that. We're not saying it's always pastor Pete. We're gonna assign it based on an attribute value. Okay?
So above, Alicia has determined who the approver is. So we're just gonna assign it to whoever she said it should be. Okay. So this is gonna give me a list of all of the attributes on the workflow that are of type person. And so I can set to the requester to the approver.
So the approver is what we'd want. Okay. Same thing. They're gonna get the email. They're gonna see a lot of the values and they're just gonna be able to add approval notes.
Now down below, we'll see that we have actually two buttons. We have an approve and a deny and we're using different button types and they're gonna activate different activities. And this is kind of a cool concept just because you have activities to find on your workflow template doesn't mean they're all gonna be activated. So in this case, if he approves it, the deny activity will never have run and that's completely fine and okay. That actually makes a lot of sense, and vice versa for denied.
Okay? So depending on what button he pushes, it's gonna activate one of these two activities down below. Okay. So let's scroll up, clean up our desk here and then we can scroll down. Okay.
So they he chose to approve it in this case. So what we're gonna do is we're gonna mark that this has been approved. So there's an attribute that we have on our workflow called approved and it's yes or no. So we will set or it's actually a text value. So we'll set it to either approved or deny.
And so we're basically just this all this action is doing is setting the value of this attribute. Next, we're gonna email the requester. And notice this time we're sending an email but we don't need any entry back from them. So we're gonna use a different action. There's a send email action.
And so we're just gonna send him and send the requester an email saying, hey, everything's good. And you can choose whether or not that that email should be saved on their communication history. In this case, it's more of an internal email and we don't really want that on their history. So and note that a lot of these fields support Lava. So right here you can say it's an update and we're gonna put in the position title right from the workflow.
So we're gonna email the requester, we're gonna email HR, same exact email. And then we're gonna mark the workflow complete. So this is a nice handy way of just saying, hey, we're done with this. Note that technically this would not be needed because this is the last activity that's activated and this is action. So if I hit this and it finished, it would automatically complete your workflow.
I as a tip to complete my own workflows. It just allows me to say at this point, I know I'm done. If someone comes and adds another activity or an action later, I know right here I'm done and I don't wanna have to worry about what could be in the future. I just wanna set it right here. And the deny process is gonna be pretty much a clone of the approval with just different text.
So that's a quick walkthrough of the sample workflow. Hopefully, that gives you a good idea about how workflows work and maybe gets you a little more comfortable in starting your own.