On my two previous blogs, I got some great feedback. Thank you all for the kind words. It will help me continue writing blogs. There is still more to write about Microsoft Flow. In this part, I will explain the Update a record action for the Dynamics 365 for Finance and Operations connector.
Update record action
In this example, I do have an Excel sheet with products that should be blocked for new sales orders. The sheet is quite simple; it contains a table with two columns (Product number and name). Suppose the sales manager will share this file within the organization, it would be your task to stop the items for new sales. When this file contains a lot of records, it would be quite cumbersome and time consuming to loop all items manually in Dynamics 365. As it is not a one-time task, ideally, you can automate this using Flow.
First of all, which entity to use? As mentioned in my previous blog, you can find the name when using the Open in Excel option. The next pictures shows you which entity will be used for updating the default order settings.
Once we know the entity, we can start building the flow. We would need the key to find the correct record for update, but that will be explained below. Let’s start with building a new Flow. This time, I used the Flow button for mobile. In that case, you can start the Flow manually using your mobile device. The Update a record action requires an object ID as shown in the next screenshot.
This Object ID needs to be filled with all key fields of the data entity eventually prefixed with the company ID if the table is a company specific (like most tables in Dynamics 365). The separator for the fieds is a comma. E.g. updating a customer would need an Object ID ‘USMF,US-001’. To be able to know which fields are part of the key, you can actually rely on the fields visible in the action frame without expanding the Show advanced options link to show all fields from the entity. You can also check the key fields of the data entity in Visual Studio.
The V2 version of the product specific order settings does require 7 fields. If you don’t have specific site or product dimension settings, you can leave the remaining fields empty. In that case, you can use comma’s without specifying values.
Additionally, you have to set the Yes value for the field IsSalesProcessingStopped. Then you can save and test the Flow.
As I created this flow with the mobile button, I will also show the option to use it. In the stores for Google Play for Android and App Store for iOS, you can find an app for Microsoft Flow. Once installed, you can log in with your organizational account. Then you will have the option to manage your Flow on your mobile device. On the Buttons section, you can see all Flows which are set to be triggered with the mobile button. Just click the button to start your Flow.
When you read this option, you would probably suggest that there are also other options to update the records. E.g. the standard Excel add-in is also capable of updating records. This is true. However, you then need to set a filter which is not easy as it cannot handle advanced filters on fields. Then you need some manipulation in the Excel sheet to set the values for some products only. Using Flow, there is just a list with products which will be looped and set a certain value. The user is not required to do additional actions and can complete his work in this example with just providing the correct file and press one button…
There is more…
Unfortunately, the current connector is not working correctly with the company identifications. If you want to update records, the default company in your user options should match the company where you want to update the records. Otherwise, you will get an error.
The full error message is: “An error has occurred. No resources were found when selecting for update.” In that case review if you need to change the default startup company. Let’s hope Microsoft will correct this quickly.
Also you may expect error messages is there is a public data entity like AllProducts which is set to be read-only. In that case, you also cannot update the records.
That’s all for now. Till next time!