PL-100 Microsoft Power Platform App Maker – Create Power Automate flows Part 3

  1. 53. Create a Twitter flow, using variables, conditions and loops

In this video we’re going to take the Twitter connection that we used in the Canvas app and we’re going to take 20 or 30 tweets each with a particular word in it. And we’re going to see what languages they are being tweeted in. We’re going to count the number of English and the number of non English. So let’s create a new floor.

So I’m going to have an instant and cloud floor because I want to be able just to start with the press of a button and I’m going to call this Twitter language count. And I’m going to start by manually triggering this. So let’s click create. Now I want to know what it is I’m looking for. I want the end user to be able to say I want you to look for this. So what we need is an input. So I’m going to have an input of some text. So this text input, first of all the question is going to be please enter your search term and the variable that it’s going to assign it is search term.

So there is our first requirements. We’re getting the computer to ask the end user what they want to search for. Next we’re going to need a Twitter connector. So here is the Twitter connector and here are the actions. Now I should say only some of the actions because there is a See more button. So what I want to do is search tweets. So I’m going to search for my search term and it doesn’t appear to be here in the dynamic content. Well, unfortunately this dynamic content is also not complete. So the best way to be able to find something is by actually typing it in, if you know what it is. So I’m searching for this text that I previously entered.

Now I can also have advanced option. The maximum number of results is defaulted as 20. You may or may not wish to change that. So now we have to go into each of these tweets. So a new step, and this will be a control step and it is a apply to each. So for each tweet I want you to do something. So the output from the previous steps, I want the tweets, I want a particular tweet and I’m going to use the body though really anything from the previous section will do. And I want to then add an action. So for each of these tweets I want you to look at the language.

So I want you to do something. If the language is English, I want you to do something else if the language is not English. So that sounds like a condition, that’s an if statement. So in my condition, if the language so the tweet language is equal to what could it be for English? It could be English but I’m not sure. Let’s leave it as English for now, we can debug it later. So if the tweet language is equal to English. Then I want you to add one to the number of tweets which are English. OK, where are we going to store that in a variable. So what I’m going to do is I’m going to add a step in between manually trigger a floor and search tweet.

I can’t add one right at the beginning. If you’re used to programming languages, you probably are used to declaring variables right at the top. You can’t do that here. You have to have the trigger first. So I’m going to add an action and this action is to do with a variable. So let’s click on variable and you can see that we have got initialize variable. So in other words, we have to declare it first. So I am initializing the variable English tweets. Now you can see the type is boolean that’s yes no integer.

So that’s whole number float, that’s decimal number object array and the string which we have used previously in the manually trigger a floor. So I just want an integer and its initial value is going to be zero. So let’s go back into this condition. So if the Tweet language is equal to English, then I want to add an action and I want again to go into the variables and I want to increment a variable. So I want to add something to it.

So the variable I want to increment is English tweets and I want to add the number one. Similarly, if it is no, so it’s not English. Well, I need to initialize a variable and that variable is going to be nonenglish tweet and again it’s going to be an integer and so I need to increment that variable. So increment that’s initialized initialize can’t be used, by the way, in a loop. It can only be used at the top level. It says increment, not initialized. And I want to increment non English tweets by one. Now, I’m not sure actually whether English is going to be correct. Maybe I need a list of the tweet languages that are being used. Okay, so I’m going to initialize another variable.

So here’s my variable languages used and this is going to be a type string. So initial value empty. So what I want to do after this condition I’ll add another action in this apply to each and so I want to append to a string variable. So I have a string variable. Notice it’s not giving me the number variables. Here the string variable language used and I want to append to it. Well, let’s look for language. There we are, the Tweet language and I’ll put a comma and a space. If I didn’t do that then it would be like for instance English, English, English all in one word. And as we’ll find it’s not actually English. So what I want to do after that is a new step and I’m going to have a notification step.

So I’ve used emails in the past. So I want you to send me a mobile notification. So this notification, it’s going to contain English and the number of English tweets nonenglish, and the number of non English tweets and languages used. And what it says the languages used are. So I’m going to save that, going to test it manually run it so you can see it’s using Twitter and notifications run or I need a search term. This is what I asked it to ask me. So I’m going to look for the word Udemy. So it’s now running. So here you can see it’s just taken a few seconds, but then I will receive a mobile notification and there you can see it on the screen. What I can also do is look at each step so that it send me a mobile notification and you will see that this is my notification. English, zero, nonenglish, 18 languages used.

So En is English, Ja is Japanese and so forth. So let’s go back into my flow. I will edit it, change this, apply to each condition to En loques e lopez n save it, test it again. So again, I’ll look for Udemy. Let’s run. So testrunning. I’ll have a look at the details here and then I get another email notification, mobile notification, which says that there are twelve English and six non English languages used in the tweets. And you can see that here as well.

So in this video, we’ve had a look at how to do variables. We’ve had a look at how we can initialize them. We’ve also looked at how we can do loops. So we’ve got an apply to each loop, but there are other loops available. For instance, if I go to the control section, you can see that there is a do until do until a particular condition has been satisfied. So do this until I’ve received a non English tweet, or maybe I’ve received at least ten of them.

And then switch. Switch says, okay, if a certain value is equal to this, then do this, or if it’s equal to this and do this, or if it’s equal to this and do this, and if it’s none of those, then here’s your default actions. So that is the switch condition as well.

So we’ve had a look at how we can initialize variables both inside manually trigger a floor and in initialized variable. We’ve had to look at how we can append to a string variable and how we can increment a variable. We can also decrement as well and append to an array variable as well. And we’ve had a look at how we can do conditions.

  1. 55. Create and monitor approvals from Power Automate

In this video, we’re going to have a look at an approval floor. Now, Approval floor is just the same sort of floors that we’ve had before, an instant floor probably, but you can see there’s a huge variety of types of approval floor. If I click on approval here at the top, we’re in templates. So you can see we can use Microsoft Forms, SharePoint and Teams and many other things.

So in this, this video, we’re just going to create an email floor. So I’m going to go to create on the left hand side, go to Instant Cloud floor. So I’m going to call this my email Approval floor and I will manually trigger this floor. So the next step is to do an approval. So you will see in approvals we have got create an approval, wait for an approval and then the two combined, we’re going to do the two combined start and wait for an approval. So the approval type, there are four different types really there’s only two, but there’s a bit of customization. First of all, if I’m sending it to five people, let’s say, do I want everybody to have to say yes?

So that would be an everyone must approve or is it the first person who actually replies to me? Alternatively, if I want to say something other than approve and reject, then I can have custom responses. So what I’m going to do is quickly look at the approve stroke reject. So you’ll see we’ve got title assigned to and some other things. But if I delete that and go for a custom approval, then you will see in addition to what we’ve had, we’ve also got the item.

So previously it was just saying approve and reject. So I’m going to say yes please and no thank you. I’m also going to add a third item, ask somebody else. So this is for my vacation or leave or holiday and I’m going to send it to my superior, yourmanager at Pcmags dot co UK. I’ll call it manager. So there are other things you can put in, like the details. I want to go on holiday, short vacation, short leave for two weeks.

So lots of other things you can do. And then my next step is going to be just a standard email. So I’m going to email myself is the outcome of leave request and in the start and wait for approval. So the previous step I have outcome. So your leave has been responded to as follows. So, very simple, we’re just starting off a trigger. We’re then starting and waiting for an approval.

So I could just say a standard approve and reject or I could have the custom responses, but I’ve also got wait for one response or wait for all responses. And then I’m just going to send myself an email based on that outcome. So I’ll save that. And you can see there’s a red dot in the floor. Checker so Power Automate approvals has not been installed for this environment. But running the approval floor will initiate it. So it can’t do this. There’s an additional step. It might just take a little bit of time. So I’m going to do this, going to do this automatically, manually. And I’m going to click Continue run flow. And it has started to run. So you can see it’s instantly come up with test failed. So let’s see where that is. That’s the error details on the right hand side.

So there is a quiet field assigned to contain no valid users from the organization. So let’s edit that. So you can’t just put it to a random email address. It’s got to be somebody actually in your organization. So you can see, even though it says email addresses, it can’t just be any email addresses. So let’s put it to one of my email addresses. And you can see while typing that it’s coming up with me. So I can put additional people. So if I put this, for instance, it will give me another version of me.

But I’m waiting for one response. So let’s save it again. Test it manually. And now you can see that it is working. And now if I go into my email, we can see that I have received this approval from Power Automate. So vacation Leave holiday requested by me. Date created. I want to go on holiday vacation leave for two weeks. So I’m going to say yes, please have a nice trip and submit. So there we go. My approval flow has finished. And now if I go into my email, you can see your leave request has been responded to as follows. Yes, please.

So in this video, we created a very basic leave request. So it’s a manually trigger floor. We started and waited for approval. So I can either have one person approving or everybody has to approve. I can have the defaults approve, decline, or deny, or I can put in my own custom responses. And then afterwards, I just send myself an email notification with details of the outcome. So that is how you create an approval request in Power Automate.

  1. Practice Activity Number 12 – The Solution

So this is quite a simple practice activity, but you get into grapes with how to create flaws. So let’s go into either my flaws or Intercreate and I’m going to create a new floor. But what type of floor? Is it automated, instant or scheduled? Well, I wanted so that when you create a new Raw in a database table, then something should happen. So that’s not an instant floor because that means it’s basically pressing a button. It’s not a scheduled floor as that would run, say every week. So it’s an automated floor, it’s reacting to events. So this is my device on Lawn.

So I’m going to skip the rest of this. And in fact, it also didn’t put in the title. So I’ll put in the title of device on loan. So I need a trigger to start with. Triggers always at the beginning. So let’s have a look for the Data verse. So here we have the Microsoft Data verse and you can see when a row is added, modified or deleted. So hopefully in the next step we’ll be able to say which of those we want. So I’m going to say when a row is added, modified or deleted. So choose when the floor triggers. So I’m going to say when it is created. What is the table? Well, the table in this case is going to be the Devices table. So I will scroll down and have a look for Devices and then the scope. So anyone can do this.

So it’s going to be the organization. So when a row is added, then what do we do? Well, let’s have a look at our actions in the Microsoft database. And what I want to do is update the row. So which table? Well, it’s the devices table. And which raw. ID. Well, it’s going to be based on the previous step, when a row is added, modified or deleted. So here we have a raw ID. However, that actually isn’t the right one to use. Now what we need, if I just delete this again, is a Guid, a unique identifier.

So let’s go back into the PowerApps portal. We can do this from here as well. We can go into Data Table, but why not keep it simple and have two separate windows and go into the right environment and into Tables, into Device and have a look for a unique identifier. And you can see that it is called Device, exactly the same as the table. So that is what we need to add, select Search for Device. And you can see here unique Identifier for entity instances. So that’s what we add in the row ID.

So I want to update the device status column. It’s not there, but I can click on Show advanced Options. So there is the device status. So I will change this so that it says on Lawn. Okay, so that’s all we need. So we said which table, which row, what’s going to be updated. So let’s save this and we test it by actually doing something. And you can see it says perform the starting action. So what I’m going to do is go back into my power apps and I’m going to go into, well, first of all, into the correct environment and then into our user and devices model. So I’m going to play it, going to our devices, add a new item. I think first of all, I’ll change this to my devices view.

So you can see the device data at the moment is blank for all of them. So I’m going to add a new item. So this is going to be a laptop. There’s my ID number going to be a laptop. Add in a date purchased. I’m going to leave device status blank. Original asking price seven. Seven. Convalue five. Five. Five. And save. And close. Now, at first glance, it looks like nothing’s happened. The device status is all completely blank. However, it’s important to realize that power automate doesn’t happen instantly. For instance, you save the record and it doesn’t immediately happen before you can see the view.

And in fact, you can see it took a second or so. Actually it took a bit more than that because it took a while for the computer to say, okay, a raw has been added. But now if I go back in and refresh, we can see that the laptop is now marked as online. So in this practice activity, we’ve had a go at creating a Power Automate floor. And while you can get complicated floors, for instance, you can add variables, you can add conditions and that sort of thing.

Once you get an idea of this is what I want happening, this is when I want the floor to start, these are the actions that I want to happen, then it’s not too difficult. You just say, okay, I need to keep a track of this, therefore I need a variable, I need to loop through all of these. Well, therefore I need a loop and so forth. In the next section, we’ll be going through the various triggers, various actions, common expressions, and sharing your flaws. Please join me there.

 

 

img