Each company has the problem that they need a confirmed delivery date for a purchase order to plan the production or the sales delivery.
With Microsoft Flow, Office 365 and Dynamics 365 for Finance and Operations since v8 it is possible to do this with a small effort in setup and customizing.
With D365FO Microsoft introduced the “custom fields”. These are fields that can easily been created by a user.
In my example i created two of these fields:
- A Date field which shows the date when a reminder for a confirmation is sent.
- A checkbox to show that a reminder is sent.
Thats all for the needed setup in D365FO
Now we have to setup Microsoft Flow to do automaticly the process.
The trigger is a daily scheduled run. In my example it runs every working day 08:00 in the morning.
The first action in the flow is to find the purchase orders where a confirmation on header level is missing.
To this we will insert an action to get records for the Enitiy “PurchaseOrderHeadersV2”.
In the Filter Query we will the following:
PurchaseOrderStatus eq Microsoft.Dynamics.DataEntities.PurchStatus’Backorder’ and ConfirmedDeliveryDate eq 1900-01-01T12:00:00Z and PurchaseOrderNumber eq ‘00000180’ and ConfRemind_Custom eq Microsoft.Dynamics.DataEntities.NoYes’no’ and AccountingDate lt
addDays(utcNow(),-3)
addDays(…)×
This query means that we filter on the purchaseorder with status backorder:
PurchaseOrderStatus eq Microsoft.Dynamics.DataEntities.PurchStatus’Backorder’
We also filter for a “blank” confirmeddeliverydate. For this we have to use “1900-01-01.” because this is the same as “blank” in this context.
ConfirmedDeliveryDate eq 1900-01-01T12:00:00Z
We also filter for purchaseorders that has already processed in the reminder process:
ConfRemind_Custom eq Microsoft.Dynamics.DataEntities.NoYes’no’
With the last part of the function we will filter on purchase order that are created a few days ago and no on the last days.
AccountingDate lt addDays(utcNow(),-3)
After we have find all purchaseorder which has to be reminded we will an apply to each section for each purchase order.
In this section step is to find the lines that has to be confirmed by the vendor.
Here we use also a get records action for D365FO. But here we use the Entity PurchaseOrderlinesV2.
In the filter query we use the following filter to find the lines:
PurchaseOrderNumber eq ‘[PO Number from the get PO Headers Step]’ and PurchaseOrderLineStatus eq Microsoft.Dynamics.DataEntities.PurchStatus’Backorder’ and ConfirmedDeliveryDate eq 1900-01-01T12:00:00Z
First we have to filter for the purchase order from the first action “find non confirmed purchaseorder headers”.
PurchaseOrderNumber eq ‘[PO Number from the get PO Headers Step]’
Then we will filter on lines that are in backorder status:
PurchaseOrderLineStatus eq Microsoft.Dynamics.DataEntities.PurchStatus’Backorder’
The last filter is to filter for lines where the confirmation date is “blank”:
ConfirmedDeliveryDate eq 1900-01-01T12:00:00Z
Next we will do a small preparation for the layout of the email we will sent to our vendor.
For this we will create a html table. Here you completly free in the design.
Next step is to sent the email to the vendor. For this we use the email field from the purchase order head to identify the receiptant of the mail.
For the subject I entered only “confirmation needed”.
And in the body i will insert the HTML Table from the step before. Here you can also add more details or standard text.
The last step is to set on the PurchaseOrder that you have sent an reminder and the date.
Here you find the complete flow in one view.