PowerApp to validate UK VAT Numbers in D365 F&O

 In my last post I showed you how to create a custom connector to validate a UK VAT number to use in PowerAutomate, in this post I am going to go through how to actually use that custom connector in a PowerApp which we can imbed in D365 F&O, in future posts I will also look at other ways you can use this API for automatic validation.

The first element is the flow which I am using which is pretty straight forward.

We use an in PowerApps step which I am using to initialize the the only parameter required to trigger the API from HMRC using the custom connector I placed in the previous post. Then I am setting the returned VRN number as a variable.



I then initialize a variable called validVRN which basically will hold the text back to the PowerApp and I do a compare too see if the VRN from the PowerApp is the same as the returned value from the API, then I set the value on the variable to either "Valid" or "Not Valid"


Then because a blank value can result in a Valid on the previous step I am doing a check to make sure that the value isn't blank, then setting a message of "Blank Value Entered"


I then pass back all the data from the API to the PowerApp to display to user:


The second element is the PowerApp itself which is also pretty straight forward:


The components are a input field and label which is editable, 





Then a button:


With the on-select property set to below:

Reset(ValidVRN);

Set(VarFromFlow,CheckVATNumber.Run(InputVATNumber));

Then numerous fields to display the data back to the user:


With the default value set to, the hash's representing what data is displayed in that field.

VarFromFlow.######

Then as added some custom colors and logo using the following 👍 Color Picker online | HEX Color Picker | HTML Color Picker (imagecolorpicker.com) to allow me to align the colors in the logo with the colors in the APP its self and using the RGBA(0,0,0,0) command to set the right color, obviously replacing whatever the color returned was.

The final step was to imbed the app into D365 F&O using the add PowerApp button and saving it a view.




Below is a short video of the app working:


Thats all for now.
















The next step is the APP which is 


Comments

Popular posts from this blog

"Exception while trying to get Virtual Entity metadata for entity" Error on Data Events

Electronic Reporting displaying Legal Entity Email/Phone by custom Address Purpose

Custom Connector for HMRC VAT Number Validation