How to create Sales Order in Business Central using Power Virtual Agent?

Now, when chatbots are becoming a more and more popular way of communicating with customers, all users would like to do more via chatbots. As Microsoft’s response to tools that can make chatbots, there is Power Virtual Agents, and the real power of Power Virtual Agent (PVA) is enormous.

But as business application specialists, we always try to think about how to connect it to some of our Business Applications. This time we plan to connect PVA to Business Central (BC). More precisely, we want to create New Sales Order from PVA and directly in BC.

How we can achieve that, and not to say it is easy, but it is not so complicated. In a concise explanation, we will create PVA with typical questions, and then we will ask some specific questions to our users so that they can give us order-specific data. After collecting data, we will use Power Automate to connect all.

But let’s stop talking hypothetically and start creating our PVA connected to BC.

The critical thing to mention is that I will not explain how to create PVA nor suggest which questions to use to trigger it and which flow you will make. I will focus only on the essential steps you must implement to create a Sales Order in BC using PVA. You can start as you like and do it in the best possible way so that it fulfills all of your requirements.

So, let’s start.

First, you will have to get three essential pieces of information from your PVA users:

  1. Account/Customer No.
  2. Item No.
  3. Quantity of Item which customer wants to buy

You can work with Item Name and Customer Name, but be aware that this can make your process more complicated because we have a few things to take into consideration before using this approach:

  1. Human error
  2. Similar names
  3. Many more questions for users
  4. Many more variables to consider
  5. Etc.

If you want to try this approach, consider this problem, and you can do it. The process is similar, only with some more steps.

But with our approach, let’s create three questions in Power Virtual Agent and define Variables for them:

  1. Choose Add Node
    1. Choose Ask a Question
  2. In Question, define:
    1. What is your company account number with us?
    1. Identify the User’s entire response
    1. Save response as
      1. Click on the Pen icon and name it VarCustomerID
  3. choose Add Node
    1. Choose Ask a Question
  4. In Question, define:
    1. What Product No. are you looking to purchase?
    1. Identify the User’s entire response
    1. Save response as
      1. Click on the Pen icon and name it as VarItemNo
  5. Choose Add Node
    1. Choose Ask a Question
  6. In Question, define:
    1. Can you tell us which Quantity you would like to order?
    1. Identify Number
    1. Save response as
      1. Click on the Pen icon and name it as VarItemNo

And now we have our questions and variables. What we have to do from here is to add a new action in our PVA, but this time is going to be active for triggering Power Automate.

To do this, you will have to:

  1. Navigate to Add node in a Topic editor in Power Virtual Agent
  2. Choose to Call an action
  3. Choose to Create a flow

And from here, you will be redirected to the Power Automate editor, and you should start creating a new Power Automate.

You will see immediately that you already have trigger and Output predefined for PVA. Just keep it, and we will use it in the process.

From here, you will have to create some Variables and, most important Sales Order Header and Line.

As you probably know, in BC, Sales order contains two tables:

  1. Sales Order Header
  2. Sales Order Line

We will have to use both. First, we will create Header, and later we will use the Find Record action to find our Item, and then, in the end, we will fulfill Sales Order Line.

Don’t worry. I will now list all actions one by one and in the order in which you will have to create them so that you’re Power Automate works at the end.

Before you start with Sales Order Header and Lines, as I sed, you will need to do some setup in Trigger and initialize some variables.

For the trigger, what you would need to do is to add you’re Inputs. You will probably understand now whose inputs are values we will get from Questions we have asked users in our PVA.

So let’s create three inputs:

  1. Text: CompanyName
  2. Text: Item
  3. Number: Quantity

And after inputs, I will list all variables you have to Initialize, and all of them will be STRING. Just create them, don’t assign any values. We will do that later in the Power Automate.

  1. Order ID
  2. Currency Code
  3. Item No
  4. Quantity
  5. UOM
  6. Total Price

Now that we have created Variables, we can continue creating records in BC. For better understanding, our Variables are here so that we can collect output at the end and show Sales Order info in PVA so that users can understand what they have created and get some information about orders they had made automatically.

If you want to create Sales Order and not use data back in PVA, you don’t need all these Variables. But when making PVA, it is always lovely to show values at the end to users of PVA.

Now let’s continue with Power Automate, and finally, let’s create a record in BC.

We will now perform three actions; you must do this in this order.

  1. Create Record V3 (Business Central)
    1. Environment Name: SANDBOX (if you are working with a PRODUCTION environment, choose PRODUCTION)
    1. Company Name: CRONUS USA, Inc.
    1. API Category: v2.0
    1. Table name: salesOrders
    1. customerNumber: CompanyName (from trigger)
  2. Find Records V3 (Business Central)
    1. Environment Name: SANDBOX (if you are working with a PRODUCTION environment, choose PRODUCTION)
    1. Company Name: CRONUS USA, Inc.
    1. API Category: v2.0
    1. Table name: items
    1. Filter Query: number eq ‘ItemNo’ (ItemNo Variable form dynamic value)
  3. Create Record V3 (Business Central) (Apply to Each will be created automatically)
    1. Environment Name: SANDBOX (if you are working with a PRODUCTION environment, choose PRODUCTION)
    1. Company Name: CRONUS USA, Inc.
    1. API Category: v2.0
    1. Table name: salesOrderLines
    1. documentId: id (from Create Record (Header) dynamics value)
    1. itemId: id (from Find Records (Item) dynamics value)
    1. quantity: Quantity (from the trigger, dynamics value)

And now, after we have created Sales Order in BC, we need to get data and show them back in PVA so that users can see what they have done.

We will do this by assigning values to our Variables. For this scenario, it is best to use Append to string variable action.

Again let’s see what we have to do here.

  1. Append to a string variable (in Apply to Each)
    1. Name: ItemNo
    1. Value: description (from Create Record line)
  2. Append to a string variable (in Apply to Each)
    1. Name: Quantity
    1. Value: Quantity (from Create Record line)
  3. Append to a string variable (in Apply to Each)
    1. Name: UOM
    1. Value: UniteOfMesureCode (from Create Record Line)
  4. Append to a string variable (in Apply to Each)
    1. Name: Order ID
    1. Value: number (from Create Record Header)
  5. Append to a string variable (in Apply to Each)
    1. Name: Total Price
    1. Value: amountIncludingTax (from Create Record Line)
  6. Append to a string variable (in Apply to Each)
    1. Name: Currency Code
    1. Value: currencyCode (from Create Record Line)

When we have assigned values to Variables, we are only left with a few steps till the end of this scenario.

Now we must create one more Variable and append value to it.

This time we are doing this to format our Output result in the best possible way because formatting output values from Power Automate in the PVA is not the best, so we want now to do it in Power Automate and later show this value in our PVA.

To do this, we will create the following Variable:

  1. Initialize variable (Out of Apply to Each)
    1. Name: Order
    1. Type: String
    1. Value: (none)
  2. Append variable
    1. Name: Order
    1. Value:
      You have created a sales Order with ID: Order ID (Variable dynamics value)

With Item: ItemNo (Variable dynamics value)

Quantity:  Quantity (Variable dynamics value) UOM (Variable dynamics value)

With total price: Total Price (Variable dynamics value) Currency Code (Variable dynamics value)

And now, we are just two more steps to the end in Power Automate.

This time we must use two actions and keep in mind that one of them is already there, so in reality, we must create one more cation (COMPOSE) and, in the end, assign that value to our PVA output.

  1. Compose
    1. Inputs: Order (Variable dynamics value)
  2. Return value(s) to Power Virtual Agents
    1. Inputs
      1. Text: Item
        1. Outputs

And now we are finished with Power Automate. All that is left here is to Save it, jump back to PVA, and map Variables in PVA so that our inputs in Power Automate can work. Your Power Automate would look like the one on the Screenshot if you created it with the exact steps I described.

To do this, you will have to go back to your PVA and inaction, which you have called Power Automate. You have to choose one which we have created just now.

  1. Choose Power Automate, Which you have created
  2. Setup Variables
    1. CompanyName (text) -> VarCustomerId
    1. Item -> VarItemNo
    1. Quantity -> VarQuantity
  3. Add Node
    1. Show a message
      1. Dear customer VarCustomerID (add a variable from the list),

Your order has been created with the following details:

Item (variable from the list)

Now you can Save your PVA and Test it to see if it works. If everything is fine, the result will look something like this.

This is not the end. You can continue playing with this PVA and add one new branch where you will create one more Power Automate for users who are not Customers in BC and first create them so that they can make an order. But this is the end for this scenario, How to create a Sales Order from PVA in BC.

In conclusion, when we can use Power Automate with some other tool natively, SKY IS THE LIMIT in what we can do.

I know that this scenario has a bigger number of steps, but in total, it is not so complicated. Still, it gives an excellent perspective on what you can do and gives you an idea of what some other Power Automates should look like if you are using them from PVA. Enjoy creating this Power automate and Power Virtual Agent.

Business Central & Power Platform Exams Experiences

Recently I’ve passed these two new exams: Business Central Functional Consultant Associate and Power Platform App Maker Associate and I would like to share some my experience about them. I’ll try to be brief and just to give you some basic directions.

First I need to admit that I’m not big fan of this kind of certification. Based on my previous experience 10+ year ago, it was more about getting certificate and less about proving a real knowledge. I had an opportunity to meet a lot highly certified persons, but they couldn’t implement even the easiest projects. But still, partners wanted to invest in certification as some kind of knowledge proof.

But with new exams in the last few years things are slightly changed and I had opportunity to check them. But with these two new exams I’m talking about, things improved drastically. And I can say I’m really positive surprised.

First what I want to say is that I didn’t prepare myself for these two exams. And when I say ‘I didn’t prepare’, I mean it for real. I wanted to see if it is possible to pass these exams with real experience and practical knowledge. And I succeed! From my perspective this is the most important fact – if you are waring with these technologies and have a real practical knowledge, you can pass them without any problem. It still means you should be focused on questions as they can sometimes be complicated, especially when it comes to the case studies. I didn’t want to say these exams are easy as they are not, but you don’t need to prepare yourself if you know topics. But to be honest, you can still find a couple of useless questions, you really don’t need in practice, but even if you fail on some of them you will still have big chance to pass exams.

What I want to mention about BC exam is to be prepared with SaaS topics as this is very important. It is not enough to know only features in system, as you need to understand cloud concept as well. On the other side, when we talk about Power Platform, you should know both Canvas and Model-driven Power Apps, Power Automate as well as other Power Platform features (AI, Chat Bots…) and CDS. But this is what we imply with the Power Platform knowledge.

If you are newbie, in this case you need to learn for these exams. But good thing is that if you want to start, you can find everything you will need on the Learning Path site. But one small note, when you start to learn from Learning Paths, I often hear that there are not enough information and some of people often fail on exams. This is because, you need to open every link you have in your learning path as often you can find basic information in this part of text, but when you click on some links, you will be redirected to Microsoft docs site with all necessary information with related topic.

On the end I want to say THANKS to all people involved in preparation these two new exams as they made a good result. And for all of you who didn’t register for these exams, do it… you will not make mistake.

15 Microsoft Ignite not-to-miss non-Dynamics Session

A few years ago, and earlier, every time when I attended some conference I’ve chose the topic I’m familiar with. For example, probably in 95% of my time I attended Dynamics NAV sessions or something very close with it.

But in the last few years I changed my attention to very different sessions. In these times, everything is different, and everything is changed. Now if you want to survive in your ERP or CRM world, you need to learn a lot of different topics outside of your primarily interest. Solutions are more and more connected and now nobody want to buy i.e. ERP, but they want to buy completely solution… and if you want to provide it, you have to me familiar not only with ERP, but with IoT, AI, ML…

Because of that, I want to write a small recommendation not-to-miss sessions for all Dynamics ERP or CRM experts on this Microsoft Ignite. As Microsoft Ignite will start in a few days (September 22-24, 2020) and registration is free of charge, be sure you registered and try to attend the following sessions:

Of course, there are a lot of other Dynamics topics and I can suggest watching sessions about solutions you don’t implement. You will expand your knowledge and in this era it is very important to know how to choose what to and when to implement; when to customize and when to integrate… Of course, this is just my opinion and prediction… if you think differently, do as you think. Definitely, try to enjoy this virtual event.

Business Central Certification Exam and more…

Yesterday on the first day of Microsoft Inspire (this year in digital format), we had an opportunity to see some long time waited news. We will finally have certification exam for Business Central. It will be MB-800 exam – Microsoft Dynamics 365 Business Central Functional Consultant and this exam will be available from October 2020. It will cover the following processes of implementation: set up Business Central, configure Financials, configure Sales and Purchasing, set up operations, and of course how to use Power Platform components. More about the exam here. When you pass this exam, you will become Microsoft Dynamics 365 Business Central Functional Consultant Associate.

But this is not all. We have more news in certifications. As Power Platform takes more and more spaces in solving business issues, we will get two new exams for Power Platform and they will be available from September 2020:

Business Central API’s and Available Methods

If you use API’s in Business Central, probably you found some limitations in methods, depending on API to API. Sometimes you can do more, sometime less. For example, with Accounts you can use only GET method (I still don’t understand why?), and so on…

You can find details about all of them here, but I prefer to have everything on one place as it will be easier to decide if I would use standard API or eventually I need to create the custom one. Because of that, I’ve made this matrix with all standard API’s and methods you can use with them:

Except these limitations, it would be nice to know that you have some other limits as well and they are important if you want to use API’s in some solutions. Even if those limits are high, they are still limits. For example, you can have maximum 600 requests per minute in production environment and 300 in sandbox. Complete list of limits is here.

And what is also important? If you are using those API’s through Power Platform (or Logic Apps) connectors, you should understand their actions and parameters. All details can be found here, but there is a table for better understanding:

It is important to mention that all that information are subject of change.

How to integrate Business Central with Dynamics 365 Talent – part 1 (Introduction)

When I think about new Business Central features, the first thing in my mind is openness for integrations. As a part of Dynamics 365 family, the main power of this solution is when it can work simultaneously with other. Because of that, I showed these capabilities in a few conferences. As I got lot of requirement to explain it in more details, I’ll write about good example of BC integrations with one other Dynamics 365 solution – with ‘Dynamics 365 Talent’.

‘Dynamics 365 Talent’ is a new Microsoft Dynamics HCM solution (new name ‘Dynamics 365 Human Resources‘). This solution was initially based on AX HRM, but now it is separated solution. As we can use it independently and this solution is really amazing HCM system, I think it can be interesting how we can integrate this solution with Business Central and make them as the powerful tool together… and with no code.

If you are thinking how to make it and how to make it with no code, the answer is using one of the Azure services – Logic Apps. As ‘Dynamics 365 Talent’ has entities on CDS and Logic Apps has connectors for CDS and for ‘Business Central’, only what we need to do is to map entities and fields in both systems and of course, to think abut business logic on the first place. Depends what is the primary reason for integration, we can choose some of the options:

  • integrate HRM core system with HR in Business Central
  • integrate Attract or Onboard apps in Talent with Business Central.

In second option, we will use HR module in Business Central and use only one or two parts from ‘Dynamics 365 Talent’. On the other side, in first option we will use core HR in ‘Dynamics 365 Talent’. In this text, I chose to explain the first option.

In this first text, I’ll just explain some basic concepts and you will find more details in the following texts with this topic.

Basic setup in Business Central

First, as we don’t need all HR capabilities in Business Central (we already have all of them in dedicated HR solution – ‘Dynamics 365 Talent’), we will move only data necessary for other areas in Business Central. In this example I’ll show how to move data to Employee table as this table can be used for example in a Payroll system or you can use this information in Fixed Assets card.

Locate information in Talent

Now when we have the basic configurations, we can continue with integration. First, we need to find where an employee’s data are saved in Talent. To find this we need to open list of CDS entities and we can do it using PowerApps platform.

When we have these basic information, we can continue with technical parts how to do it in a practice.

Sessions from NAV TechDays – day 2

As I’ve promised a few days ago in my previous post, I’m completing the collection of all session from NAV TechDays 2019.

Let’s see what we had in the second day of this amazing NAV/BC event:

Leveraging the power of the cloud

Build, test, deploy and deliver your app by one file

NAV/BC for high demanding environments

{Connect app}²

Business Central with Power Platform – more than ERP solution

…and of course, this is my session where I’ve talked about PowerPlatform with BC together with an MVP Renato Fajdiga… expect feedback here 🙂

The Power Platform for Business Central Techies

If you liked my and Renato session, I’ll highly recommend to continue with this session from Arend-Jan Kauffmann.

Make the most out of Business Central on Docker

Migrate your customers to the cloud, and manage them there

How to make AI work for your Business… Central

Sessions from NAV TechDays – day 1

NAV TechDays 2019 has just finished a few days ago and I can say this was amazing event and again the biggest one – with 1452 attendees. As I promised the last year, I prepared session this time and made it together with an MVP Renato Fajdiga. I hope to see you next year again.

In a meantime, all sessions from the first day are already published and I want to have all of them on the one place. As soon as we have sessions from the second day published, I’ll add them. There are all of them:

Opening Keynote

The road from C/AL to AL

Development Methodologies for the future

How to run faster in SaaS

Unlocking new integration potential for 365 BC with Azure Event Grid and Azure Integration

Give Business Central access to your data files

Control Add in development supercharged

Developing for Modern clients

Using Docker and the ContainerHelper to convert your C/AL solution to an AL solution

#MSDyn365BC new Era of Integration: Intelligent Edge, SmartLists, Azure Service Bus and more!

My Sessions during Fall 2019 Conference Season

This fall I’ll be active and attend to four conferences as lecturer. If you want to see some of my lectures or to meet me, register for some of these events:

BCEE People, Prague – Business Central Roadmap in CEE countries

Directions EMEA, Vienna – Demystifying Posting Groups in Business Central (for partners)

BCUG Summit NA, Orlando – Demystifying Posting Groups in Business Central (for users)

NAV TechDays, Antwerp – Business Central with Power Platform (together with Renato Fajdiga, MVP)

My Sessions on Directions North America 2019

Directions Asia has just finished, and we will continue with spring conference season in Dynamics. The next Directions will be in North America in Las Vegas in period May 5-8 in Red Rock Casino Resort & Spa. Registration is still available.

This year I want to show you about benefits of integration with different Dynamics 365 solutions. Why? Generally, I think we have great features in Business Central, but possibility to integrate this solution with other solutions using Azure tools or using different UI are the amazing possibilities. These options are why it is important to have Business Central in Dynamics 365 family.

Because of these reasons, you can find my sessions in agenda. From today (April 12th, the full agenda is available):

How and Why You Should Combine Dynamics 365 for Talent with D365 Business Central (May 7 2019, 8:00am, Room: Veranda B)

‘Dynamics 365 for Talent’ is a new Microsoft Dynamics HCM solution. This solution is available independently or through Unified Operations plan. Because we can use it independently, it is interesting if we can integrate this solution with Business central. You will see how to integrate Talent with Business Central and very important thing – without coding. And of course, you will see different integration options based on different user scenarios.

Using Model-Driven PowerApps with Business Central (May 5 2019, 3:15pm, Room: Red Rock A)

Although on the first sight, there is no so common things between Business Central model driven PowerApps, it can be very useful if we could use it with Business Central. Generally, model driven PowerApps is a tool for CRM development, but there are many reasons why to use it with Business Central. If you want to know why, come to this session to see why to do it and how to do it… and maybe even more. As we expect more and more CRM and ERP solutions in simultaneously work, it can be very interesting.

OK, I will not write more, but if you think these topics are interesting for you, you are welcome on my sessions and see you in Las Vegas.

And of course, my sessions are not only reason to come on Directions 😊. You will find great sessions there… you will see details about Business Central Spring release ’19 as well as amazing sessions by MVP’s and other experts.