Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Learn with Subs / PowerApps tips: perform D36...

PowerApps tips: perform D365F&O CRUD operations on Canvas Apps

Subhad365 Profile Picture Subhad365 7 User Group Leader
Hi friends, today let me give you a couple of ideas as to how easily bring data from D365F&O in your Canvas Apps: especially when you want to
 a, Fetch data from D365F&O and display them on Canvas Apps
 b. Do validations
 c. Create records in D365F&O by inputting data in Canvas Apps

And guess what, all these things could be done quite easily -- without the need to write any code. Yes, very easy -- let me show you how.

Step 1:

We are creating a form which would be accepting inputs from user to create a customer record in D365F&O.

Following are the controls:
TxtDataAreaId à a dropdown that should the collection of Legal entities from D365F&O
TxtCustomerCode à user input for customer code
TxtCustomerName à user input for customer name
TxtCustomerGroup à a dropdown Customer group
TxtCustomerAddress à Customer address
TxtCustomerCountry à a dropdown for customer country
TxtCustPin à a dropdown for Zip postal code, dependent on selected country
TxtCustCity à a dropdown for cities, that should show lookup based on selected country
TxtCustCurrency à Customer currency

Step 2:

Start with adding clicking on Data >> Add a data-source:

Filter out by searching for Fin & ops apps:

 Choose the tables (for ex: for Legal entities dropdown, will need legalEntities, for Customer Groups we need CustomerGroup, etc.):

And select Connect.
You would see all data sources to have got added to your data pane, consequently.

Go ahead and add your control to the necessary datasource:

Click on Edit to select which field do you want to map your data source to:

Step 3:

Next will need to filter data on dependent fields. For ex: I would need see only the selected cities for the given country, or only the selected postal codes for the selected country.
Select the city control and click on Depends on link:

And do the necessary field mapping:

Which means, I am ensuring the parent controls’ selected Country region to match with Address Cities >> Country region. Which actually results in the following equation from the formula bar:

I did the same for Address Postal code as well:

This automatically fetches the cities from the county value in the dropdown:


Step 4:

We would now proceed with creating a Flow that can help our data be passed on D365F&O. I am sure, most of you all, by now, have guessed what all this is going to be 😊

From the ensuing popup choose to create a new flow:

Here we are starting with the step: ‘When a Power Apps calls a flow (v2)’ and we are defining all the inputs here:

In the next step, we are defining the token generation logic:

And then we are setting the variable for HTTP token:

And then we are posting on to CustomesV3 by the following HTTP call:

As an extra step, we are encapsulating the HTTP call in try-catch scope, which says:

The catch is configured to run after try only if it has failed:

We are storing the responses in a variable called Status, which gets set to Created on Success:

Let us return the status to Flow:

Once done, let us save and publish the flow.

Step 5:

Calling the flow is very easy.  Refresh the Power Automate list, and it will start appearing in the Power automate list:

And in the Submit button >> OnSelect >>

We are setting the outcome in a variable called status. And we are keeping a Label that gets displayed with a text, depending on the outcome (status value).

And when we are running it, we will get:


Additional validation:

We can include additional validations like: if we don’t enter customer code or group, the submit button will stay disabled:

 In the Reset button, you can give a reset logic:

Here you are declaring a variable called content, which you are setting to true and immediately setting to false.
And you can use this variable in all the controls which you want to reset on clicking Reset (eg.— as an example, consider the address text field: Reset formula):


With that, let me take your leave. Will come back again with many such cook hacks to integrate D365F&O with PowerApps. Till then Namaste and much love 😊
​​​​​​​

Comments

*This post is locked for comments