Amey Holden

View Original

How to use PCF controls in Model-driven Power Apps and Dynamics 365

I’ve posted a lot about the amazing PCF and Custom Controls available on pcf.gallery without ever really explaining how to add the controls. I also have a really cool PCF control that isn’t available on pcf.gallery but it is something my Australian friends would find very useful indeed! The ‘thing’ itself is a ‘Power App Component Framework control’ also referred to as a ‘Custom Control’. I teamed up with some friends of mine at CloudFlow365 who are those ‘proper’ developers and pretty nifty with PCF to bring to life the ‘Australian Business Register Name Search’ control!

Custom controls let you transform app user interface components, such as a column or view that traditionally contain text, into visualizations. Custom controls can be configured on columns, forms, dashboards, views, and grids. - Microsoft

Not all Custom Controls are equal

Depending on how the control is designed, will determine where it can used. For example an ‘Editable Grid’ control cannot be used on an text column. It won’t show as an available control when you select the text column, but it will show available on a grid place on a form. Likewise, the other way around. There are many ‘undocumented’ controls which show up, quite often they are released as part of a Dynamics 365 app or an ISV solution. You are welcome to play with these but use with care. Each control will have different ‘properties’ that it needs you to set up to get up and running. For example, an ABN lookup control requires a search field and type, whilst an map control needs longitude/latitude and a key to connect to the map services.

Switch to classic

There is a ‘place’ to use custom controls in the modern maker experience but it does not show the full suite of what is available. An example of a custom control that you can add in the modern maker experience is the Rich Text Editor, but many others cannot be added this way. So my best advice, to be able to see all the ones that are available is to switch to classic when configuring custom controls.

Configure ABN Lookup Custom Control Step by Step

The neat thing about this being a custom control is that you can use it on any table (custom or out of the box), so long as you have a single line of text column to configure it to. First, we need to import the AustralianBusinessRegisterSearch solution.

Where’s the instructions?

There is a lovely configuration page included in the solution which has some instructions also, its just a little tricky to find. After installing the solution, open the solution and select 'the component called “Australian Business Register Search Configuration page“. Select ‘Advanced Options’ and open the URL. This will launch your instructions document in a new window.

Register for ABN Lookup Web Services API

It’s completely free! It is obviously subject to terms and condition so ensure you are aware of what they are but otherwise its just a quick form fill and you are ready to go with your API key -> https://abr.business.gov.au/Tools/WebServicesAgreement

Add the control on to the form

Open the form in classic mode, add the column you want to search on to the form somewhere (it must be a single line of text).

  1. Ensure the column is selected

  2. Select ‘Change Properties’

  3. Switch to the ‘Controls’ tab

  4. Select ‘Add Control…’ and find the ‘Australian Busines Register Name Search’ control

Map the properties

You may need to create some additional columns depending on what information is valuable to you.

Required columns as a minimum to get the control up and running

  • ABN

  • API Key

Note: The search field doesn’t need to be a separate field, it can just be the column of what you are using in your query to search (ABN/ACN/Business Name).

Required setting

  • Search field

Additional Columns that are retrieved from the lookup service are as follows, you can map all or none of them its up to you.

  • Entity Name - The ‘official’ name of the business

  • Business name(s) - also known as trading names, more common for larger business. This returns as a comma separated list of values. .g. Woolworths Group Limited trades under so many names including these WOOLWORTHS, DICK SMITH ELECTRONICS, BWS-BEER WINE SPIRITS, DAN MURPHYS, FIRST ESTATE WINE MERCHANT etc.

  • ABN - Australian Business registration number

  • ASIC Number - Australian Securities & Investments Commission (ASIC) number assigned when a body becomes registered as a company under Corporations Law. i.e. the company number

  • Business state - the state of the main business location, usually the ‘registered address’

  • Business postcode - the postcode of the main business location, usually the ‘registered address’

  • Entity Type - indicates how the business is registered for tax e.g Individual/Sole Trader or Limited Partnership

  • Current status - active or cancelled if the business has stopped trading

  • Status date - the date the ‘current status’ was last updated

  • GST date - if populated indicates the date they registered for GST, not all businesses register for GST

Full official glossary can be found here -> https://abr.business.gov.au/Help/Glossary

Additional Settings which control the visuals and default filtering of the control. Users can update the filters after loading as required but its hand to give the most ‘typical’ filters for your organisation as a default.

  • Active Only - filters the search to only include active results, cancelled results will not be shown

  • ACT/NSW/NT/QLD/SA/TAS/VIC/WA - filters the search by Australian state

  • Header/Option/Button Color - controls the colours on the ABN lookup panel so you can style them to suit your brand and accessibility requirements

Publish

Publish the form changes, load up your form and make sure you do a ‘proper’ refresh (Ctrl+F5 or Ctrl+R are your friends). You are ready to search business details on the official Australian Business Register straight from your Model-driven app using Dataverse or Dynamics 365. isn’t she a beauty!?

Where can you get it?

It is coming soon(ish_) to app source but prior to that it will be provided as a supported, managed solution by CloudFlow365. It’s super quick to install! Please contact me to discuss licensing and any other questions you might have.