PL-100 Microsoft Power Platform App Maker – Business logic using flows

  1. Create Dataverse classic workflows

Hello. And in this section we’re going to have a look at business logic. Now we’ve already had a lot of business logic so far. We’ve seen how these triggers and actions in Power Automated can help with business logic. We’ve had a look at Canvas app formulas and events and we’ve had a look at business rules. Well, we’ve had a look at flaws. So flaws being triggers and actions.

However, there was classic way to do flaws as well. And that’s what we’re going to have a look at in this video. And we need to have a look at it because of the business process flaws that are going to be in the next video. So the older way to do this is if we go to PowerApps, so not Power Automotive Power Apps. Click on the gear, go to Advanced Settings. Normally we would then be going to customizations and we’ll get into the Solution Explorer. However, this time we’re going to go across two processes on the Process Center.

So let’s click on here and we’re going to create a new classic workflow. We do that by clicking on New. We give it a name. So I’m just going to call it Email me, we can give it a category. So this category is going to be a workflow and we give it an entity. So the entity could well be the expense entity. Now, once you’ve created this, then the category and the entity cannot be changed. Now there are two types of classic workflows. As you can see here, there are background workflow. So this allows the system to do the workflow when resources are available. So it’s not immediate, but it will generally start in a few seconds or minutes. You may need to refresh the form once it has been done to see any results. The alternative is the real time workflow.

So use this when you want to immediately see the results or when you want to have real time, say deletions of operations. Now, when we’re talking about the classic workflow and how that compares to Power Automate, you can see that Power Automate is preferred for background workflows. However, there is no such thing as a real time Power Automate workflow. So you do this when you want the work to be done right now, and everything else stops until the workflow is completed. So I’m going to have this as a background workflow. So I’ll click. Okay. So that opens up another window. Now you can convert between the two with this button up here.

Convert to a realtime workflow or convert to a background workflow. Now we have your steps here. Just one note. If you are doing a realtime workflow, then you cannot have a weight condition. It doesn’t work. So we can add stages. Well, stages are just headings. It doesn’t actually affect what happens in the workflow. It just makes it easier to read. You can create rows or records. You can update or assign rows or records. You can send an email or change the status and that could be based on the current row. It can be based on your relationship, so it could be based on other tables, or it could be based on things done in earlier steps.

Now, when you’re updating records, you do get the option of setting appending, incrementing, decrementing, taking away, multiplying or clearing values. So if I click on the date of expense, you can see that you can set it to various things before or after, for instance. So what else can you do? Well, if I just click on that and delete this step, you can also start child workflows. So you can see if your classic workflow can be run as a child process because you will have it. This checkbox, you can stop the workflow so you can set the status message in there to either succeeded or canceled. And then there are other things like custom steps which are there for developers only.

So you can really get into this in quite some level of detail. But we don’t need to do that for this course. So I’m just going to delete these steps. There are also conditions. So, for instance, should I do something if I go to a check condition? So this is an if condition. So if something does or doesn’t equal something, whether it contains or doesn’t contain data, whether it’s under or not under but that’s when you’re working with Hierarchies you can have Conditional Branches.

So Conditional Branches are if you have done something, then do this conditional Branches else if you something else so Conditional Branches can only be done after an if and won’t be run if the if is true and then you’ve got default actions which are right at the end so you can have one check condition, as many Conditional Branches as you want and then a default action if you want at the end so if the sky is blue, then do this otherwise if the sky is red, then do this otherwise do this so going to delete this all as one step we can wait so we can pause until certain conditions are met so that is for background workflows only and if we’re waiting, well we might have parallel weight branches so alternative weight conditions so who runs this?

Under what conditions? Well, you’ve got a scope, so the scope is here, so it could be for your user. So that means that the workflow will only run for the particular user. So that is the default. Or you can go all the way up to organization. So that applies for the entirety of the table for all users. Now, you can also start the process when the record is created or when the record status changes. So that could be it changes from active to inactive when the record is assigned. So who owns it when certain record fields change and when a raw is deleted. Now, if this was a real time workflow, which I’m converting it into, then we can also have it before or after the record status changes or the record is assigned, or the record fields change.

So it’s only before a record is deleted or after a record is created. So what I’m going to do with this particular floor, I’m just going to have it as an on demand process and I’m going to add a step. I’m going to send an email. So let’s create a new message. You can also use a template. So I’m going to send myself an email. Now, unlike the email that I can do in Power Automate, I can’t just type in an address like that. It’s got to be someone in the organization. So I’m going to just get rid of that and put in me. So there’s plan, power platform plan. And here we are.

Email, email. So I’ll just save and close and I will save and close this. So now we’ve got our classic workflow. You should note that its status is draft. It has not been activated. So I’m going to click on it and I’m going to activate it. So click OK. And only now can you actually use it. So this is the classic workflow. You get into it by going to the gear, advanced settings and then go to processors. And there are two types of classic workflows.

Background workflows, which doesn’t happen immediately, could happen in a few seconds, a few minutes, or real time workflows when you want to immediately see the results of an operation. And Power Automate only does background workflows, also known as asynchronous workflows, real time workflows, synchronous, immediate. They can only be done as a classic workflow.

  1. 47. Create Dataverse business process flows – Data Steps and Conditions

In the previous video, we created a Dataverse Classic Workflow and we’re going to use that when demonstrating the dataverse business Process Flow. So if I go back to Power Automate and go to my flaws, you can see that this section here is Business Process Flaws and you can see that the system business Process flaws included include things like Challenge Management, Process Idea to Project Business Process and Translation Process. If we go to PowerApps, then we can also do this by clicking on Floors on the left hand side and then going to Business Process Flaws that way. Now, there’s also a classic version as well and we’ve seen how we can get into that.

We go to Advanced Settings, we’re going to the Wheel Advanced Settings and then we go to Processors and New and we create a new Business Process floor from there. But we don’t need to have a look at how to do a classic Business Process Flow in this course. So let’s create a new business process. Flow. What is a business process flow. Well, I’m wanting to not have all of the data entered all at once. I want a little bit in one stage and then a little bit more in another. Well, a Business Process Flow allows you to have up to 30 stages. Now, you can use it with model driven apps and you can use it with the Data verse. You can’t use other data sources, but you can use up to five different tables in a single process.

Each table can have up to ten business Process flaws so there aren’t too many restrictions. So if I click on New, I can name this. So this is my Business Process Flow and I have to choose a table. So I’m going to choose the expense table and click Create. So here we can see the outline of our Business Flow. And this screen is one that we’ve had a look at previously when we were looking at business rules. However, it’s a bit expanded. So what I can do is I’ve got this first stage. This first stage has got a data step in it. The data step is not configured so I can select a data field to be entered.

So I’m going to select the expense value. Now, maybe I want to be able to select more than one at one particular stage. So once I’ve clicked Apply and that’s very important, otherwise your things don’t get saved. I can drag a new data step in this stage. So let’s get, for instance, the date of the expense. I’m going to say that is required. So make sure you put anything that is required with this checkbox. And you can see the sequence number one and then number two. So this stage, which I’m going to click on, I’m going to say that this is the first stage of entry. Now, after this I’m going to have a second stage.

But whether I ask for everything depends on how much this expense value is. If it’s more than say, $99, then I want you to be able to give a description. I’ll also ask you for the ID, or if it’s not above $99, I don’t want the script, I’ll just give you the ID. And so I’m going to add a condition and I’ll add it to the right hand side. So here we have the condition. So this condition I’m going to say is the expense value greater than the value. You can use a field or formula more advanced $99. So you can see at the bottom expense value is greater than 99. So click apply now. I’d also have a look at the validate.

Just keep it open, it tells you if things are wrong. And here you can see I haven’t got what happens if the condition is true. What happens if the condition is false. So I’m going to now drag in another stage into the what happens if the condition is true? Well, if the condition is true, then you can see a dotnexis data stage. I have not entered anything.

I want you to be able to type in the description apply and I don’t know if a data step into this stage. I also want you to be able to put in the ID Applying Now if it’s false. So putting a stage into the false, the condition is false and I’ll have to hide these details to be able to see it. But you can see that there are two data steps there and zero triggered processes. We’ll get into that later. So if it’s false, then I’m just going to ask for the ID. And then finally I’m going to click Add here, just add stage. Just so you can see there’s no other way of doing that. I’m going to ask for the account. So here I’m going to select the account and say, yes, it’s required.

Apply now notice what happens if this condition is true. Then we go to this stage for description and ID and then this stage for the account. And you might find it quite useful to name the stages so you know exactly what they are, even if all of the details are closed. So if it’s greater than $99, then we go this way. If not, we go this way down to this bottom bit where we’re just asking for the ID. But then I want it to go back to the account I want to rejoin and that is called the connector.

So I’m going to click a connector and I’ve got to say Connect. And you can see that it is connecting or wants to connect the first point with the second point. So I click on the first point, click on the second point and then now you can see it is connected, right? So what I’m going to do is I’m going to save this. It’s already validated and importantly, just like with the business rules, I need to activate it.

So now I can activate it. So let’s have a test and see what it can do. So if I now go to Power Automate, if I just refresh, this should now be enabled and I can play and notice what I get. I get the same form that we have previously designed with an addition this process. So I’m going to say that the expense value is 999. Notice what happens over here.

Currently it’s just asking for the ID that changes to Description and ID. So then I can go to the next stage equally. If I change this back to $7, then it’s just asking for the ID. So let’s now ask it for the Description. So this is a description and an ID 1234. And then we’ll go into the account and you can see we’ve got lots of different records in the accounts table that we can add in and all this is being processed in the background as well. It’s just doing it in a more tidy manner. Now, additionally, we can go back to our Power app.

So I’m just going to close that so it doesn’t get saved. And I’m going to go to our apps and our Model driven Accounts and Expenses app that we have previously designed. So I’m not making any changes to it. I’m going to play it. So here we are in my active accounts. I’m going to change this now to Expenses. I’m going to click on New. And right at the top here we have our Business Process Flow automatically included. And the reason it’s automatically included is if I go to the edit of this app that over here, we’ve got Business Process Flows and it says all.

So this will be all of those that are relevant. So in this video we’ve had a look at how we can create a Business Process Flow. We’ve seen that you can have stages. Stages can have things like data steps and you can also also have conditions. And these data steps of course, can also be marked as required. But whenever you do any of these additions, make sure you click on the Apply each time or your changes won’t be saved.

img