Dynamics 365 Business Central: Flows
I wonder if I could set Microsoft flow to pour me coffee, let me see. I have Java 300 here as a connector in Microsoft Flow, that is awesome. What should I hook it up to? how about if whenever we make a sale, he pours coffee? Let's see, that should do it.
I’m bored, no one has had coffee for nearly two hours, finally. I sense a disturbance in the Microsoft Flow, it seems that Johannes has triggered a coffee service on every sales order posted. There we go. A new sale to Frabrikam, Johannes your coffee is being served. Have a nice day.
Flows in Microsoft
Now that we configured Java 300 to pour coffee on every sale, lets venture into something else. If I go into items and into my Inecta coffee mug, I see flows up here, this connects to Flows in Microsoft which is part of Microsoft stack. It's technically not inside Business Central. Therefore, it connects to anything in the stack and even outside stuff. I’m going to say, create a flow. I’m going to pick a template called low stock warning. I click on that and the system tries to connect to the service that it needs, which is Business central and Outlook. So, what is going to happen here, it's pinging the item card, and whenever there is a change on the item card, it's going to check for the inventory and send an email if there is low stock. I just continued here, this is where it gets interesting. I get a diagram of the entire Flow and I can change it any way I want.
I was looking through it, it needs a little bit of configuration even though its template. For example, you must select the company that you are working with, and if you are doing this yourself, you want to go through it. If you click here on edit, it references a table called Items. This is a web service in Business central, you have to activate a web central called Items and in the latest version of Cronus, this web service doesn’t exist. So, you must go in and connect it to the page, the item list page and activate that. I’m going to show you in a minute how you do that. Then it goes down here, checks inventory and if its greater than or equal to 10, then it goes here and checks when its less than 10 and then sends an email. The logic here is a little fuzzy to me but it does go through. Let me just add the email, I have spent searching to whom it sends the email to. That can be a dynamic thing. You can code this to pick email addresses for different areas, but I think this here works better as an example than something you would be using. There are other ways to check for lower inventory stock in Business central.
I’m going to go ahead and save this, so I have configured it to get the items list out of web service and it's going to send an email to Paul whenever we have a change to the item card and the inventory is according to these conditions. I close this out, now my flow is active, and I can actually go into flows, so if I go into my Microsoft stack, and I go into flow, it opens up flow screen. Now I’m in the Flow area, not in business central. You can see that have the low stock warning flow active, that was 36 seconds ago. And it has never run, but it’s just sitting there. Let’s go ahead and go into business central. I’m just going to change the name of the item just to trigger the records change to coffee mug 2 and close this out then go to the flows, the low stock warning and see if we can get this actually to run. That might take a little time. I think it checks every minute.
Meanwhile, it's running, I'm going to go into items and show you how you can access to flows and see my flows here, so if you look at that, it actually runs the same view as you see in flows over here. Again, it’s displaying the same thing as you have in manage my flows. It's just inside Business Central. This is how, it’s nice that is actually connecting on the stack and then finally while this is running, and I hope this can go through before the end of the video.
Set up web services
I’m going to show you how we set up the web services, If I go up here into web services, this table here, you have to actually edit. So, I have to create new and I’ve done that already and I’m going to show you how that is. If I go into the sort by object name, just going to refresh it and give it alphabetically by object name. You can see here I have the page 31 items right here and I have published that. Once you publish that with this name, the service name is items. Then the flow will recognize that, so it connects to that. Let’s see if we have had an update on flows, yep. I ran, it's actually running right now which is great. Let's refresh this, here we go, go back. Now it's actually checking.
Let's go ahead and take a look at the items and I’m just going to reduce this to less than 10 so that we can trigger it. I’ll do my handy-dandy screen here. Adjust inventory, take this down to 5, ok. You can see how it actually goes here, when the record is modified condition and it ran, now it triggered that I went underneath and it sent an email. Its really cool to be able to go through the workflow like this, very classy Microsoft. So it succeeded and let’s go ahead and take a look and it says there is a low stock warning, there is an email sent out and this successfully ran. Basically we get an email that there is a low stock warning, I think this should be telling me its 4, not 49, so that might be just an error in the workflow but hopefully, you get the idea. This is a standard workflow that is available on the Microsoft flow and it is not perfect but it’s a good start. But Java 3000 workflow is way cooler.