Create Sales Order with LUIS

I think every company is thinking about how to automate business processes especially for standard process that are there every day in the same needed steps. One of this processes can be the Order Entry process for standard products.

I will describe in this blog post now Microsoft Flow and  LUIS can help here to automate this process.

And the complete process can take only a few seconds to be completed from incoming email until sending a entry information.

The first step is to setup and train LUIS.

I have setup an intent with entity.

If you want to learn more about setup of LUIS please go to luis.ai.

In this blog post I will focuss on the things to do in Flow.

After setup is done in LUIS the setup in Microsoft Flow can be done.

There we have to define the trigger which is called “When a new email arrives”.

To get only the emails with subject “order” we set the subject filter to “order”.

The next step is to format the body of the email into plain text for better output from LUIS.

After this a LUIS action is needed to detect the entity “item” in the email body.

For this we select the “get prediction” action and fill out the needed fields:

  • App ID : your App from LUIS.ai
  • Utterance Text: The plain text from the “HTML to Text” action
  • Desired intent : the intent of the entity we are looking for

After doing this we need the correct customer account in Dynamics 365 for Finance and Operations to create the Sales Order. For this we use the “Get Records” action.

Knowing that in our setup the primarycontactemail is the right field to find the correct customer.

So we add in the Filter Query section the statement to filter the customer accounts using the field PrimaryContactEmail is equal to the incoming emailadress.

With this record a new sales order can be created. Additional to the customer account number we get the dataarea ID where we have to create the sales order.

These 2 information are used in the next action which is called create a record. To create a sales order we have to choose the correct environment and the entitly called salesorderheaders. Using only these 2 information we can create a new sales order.

After the sales order header is created we need to fill the sales line. For this we use again the action “Create a Record” but instead of entity SalesorderHeaders we use the entity SalesOrderLines.

To fill the correct SalesOrder we use the same 2 informations (dataAreaId and Customer Account) and additional the Sales Order Number from the Create Sales Order Header action.

After creating the sales order we want to inform the customer that the order is entered and we send him a possible delivery date which we will confirm in a later step. For this we use a office 365 action called Send an e-mail and use as the To email Adress the email adress from the incoming order and in the body we add some field from the created sales order.

The next steps are done in the ERP system Dynamics 365 for Finance and operations.

Now a sales person has to confirm the sales order. For this there is a workspace in Dynamics 365 for Finance and Operations available:

  • Sales Order processing and inquiry

In this workspace there are 2 options available to find the unconfirmed orders:

  • The Tile on the left side “unconfirmed”
  • The list “unconfirmed.

This process steps will not be described in this blog post.