Using Microsoft Flow to Synchronise Accounts in Field Service to Suppliers in Finance and Operations

It is an exciting time for everybody involved in implementing Microsoft Dynamics 365 projects. Integrated solutions that once required complex and costly developments can now be delivered with simple drag and drop style services.

One such service is Microsoft Flow and we have recently used this free, easy-to-use technology to implement a simple but powerful interface to synchronise Accounts in Field Service to Supplier records in Finance and Operations.

It is important to note that Microsoft provides out-of-the-box integration for specific business processes between Finance and Operations and Field Service using the Common Data Service (CDS). For more information on this, take a look at this Microsoft Docs page.

The business scenario covered in this blog is not provided as a standard template. Given the low volumes and ease of use, Microsoft Flow seemed like the perfect choice. So here we go, read on for my fairly comprehensive guide...

The Challenge

Our customer is a large retailer that provides a bespoke fitting service to their customers. Contractors are scheduled within Field Service to deliver products and to fit them in the customers' home. These contractors are paid directly by the retailer and therefore the invoice processing and subsequent payment runs are managed within Finance and Operations.

Since Field Service is where the scheduling takes place, it is here that a contractor will first be created as an account. Clearly, in order to pay them, they must also exist as supplier records with the relevant information in Finance and Operations. Using Microsoft Flow to create an account to supplier interface is a good case in point.

The Checklist

Before attempting to configure your own flow it is useful to tick off the following prerequisites:

  1. Read the Microsoft Docs page Get started with Microsoft Flow. If you haven't done so already, sign up and follow some of the simple guides provided.
  2. Ensure your user is connected with a test instance of Microsoft 365 for Field Service
  3. Ensure your user is connected with a test instance of Microsoft 365 for Finance and Operations. For production instances, you would typically configure a service user in each system. Ensure that you consult your technical team on this.

The Solution

Complete the following steps to create your own Microsoft Flow:-

  • Open Microsoft Flow.
  • Select 'My flows' from the task bar.
  • Select 'Create from blank'.
My_Flows.png
  • Select the button 'Create from blank'
My_Flows_Create_from_Blank.png
  • In the top left hand corner of the screen enter a name for your flow
My_Flows_Name_Your_Flow.png

 

  • The first thing that you need to do is add a trigger. In this case we want to start this flow when a new Account is created in Field Service. From within the search box, search for 'Dynamics' and select 'Dynamics 365'.
  • Select the trigger 'Dynamics 365 - When a record is created'.
My_Flows_Select_Trigger.png
  • Once the trigger has been defined, under 'Organization Name', select the Dynamics 365 instance where you want the flow to listen. You can only see instances that you have created a connection too.
  • Select the 'Accounts' data entity.
My_Flows_Select_Instance.png
  • In this case, I only want to create a supplier in Dynamics 365 for Finance and Operations if the Field Service account is identified as a specific type. A custom field was created in Field Service to identify accounts as being contractors.
  • When you select the first box of the condition, a dynamic content pane appears where you can search and select a field.
  • Select the field you want to use as the identifier.
  • Select the condition 'is equal to'.
  • Enter the value
My_Flows_Add_Condition.png
  • Expand the 'If yes' tab highlighted in green. We can leave the 'If no' box, highlighted in red.
  • If the value passed equals the identifier, we can now create action for the supplier to be created in Dynamics 365 for Finance and Operations.
  • Select the action 'Dynamics 365 for Operations- Create a record'.
  • Select the entity 'VendorsV2'
  • In Dynamics 365 for Finance and Operations, you are required to specify a legal entity. You can either enter the value or create a custom field in Field Service to ensure the company code is set when the account is created.
  • Enter the value for the supplier group.
  • In this case, I leave the supplier account number blank. If you do this, the account number will be generated automatically in accordance to the number sequence setup.
My_Flows_Add_Ops_Action.png
  • Expand the field selections by selecting 'Show advanced options'
  • Configure the required fields to be populated when the supplier is created. In this case, the following fields were mapped: -

Account type = Vend (Drop down value)
Supplier hold = All (Drop down value) 
Name = Account Name (Field Service field)
Primary phone purpose = Business;Remit to (Enter value)
Primary phone description = Phone (Enter value)
Primary phone = Main Phone (Field Service field)
Primary email purpose = Business;Remit to (Enter value)
Primary email description = Email (Enter value)
Primary email = Email (Field Service field)
Name or description = Account Name (Field Service field)
Street = concat(triggerBody()?['address1_line1'],' ',triggerBody()?['address1_line2'],' ',triggerBody()?['address1_line3'])
City = Address 1: City (Field Service field)
County = Address 1: County (Field Service field)
Postcode = Address 1: ZIP/Postal Code (Field Service field)

  • For the street field, you will need to use the 'Concat' function to concatenate the address fields from Field Service.

concat(triggerBody()?['address1_line1'],' ',triggerBody()?['address1_line2'],' ',triggerBody()?['address1_line3'])

My_Flows_Concat_Function.png
  • Once the mapping is complete, save and test your flow.
  • Select 'Save'
  • Select 'Test'
My_Flows_Test_1.png
  • Select 'I'll perform the trigger action'
My_Flows_Test_3.png
  • Now create an account in Field Service

The Result

If the test was successful you will see your new supplier in Dynamics 365 for Finance and Operations. Although this guide talks you through a specific business case, hopefully it provides you with enough information to adapt it to your own needs. 

Account in Field Service

My Flows Field Service Account.jpg

Supplier account in Operations

My_Flows_Supplier.png