Canvas apps are amazing. Seriously so. I’ve been developing my knowledge around them, and it’s incredible what you’re able to do with them. Clients are loving them as well, with how quickly it’s possible to develop something that’s visually appealing.
From a licensing perspective when looking at using data into/out of D365, I’m usually using the CDS as the datasource. This means that apart from a handful of scenarios, users would be licensed with a PowerApps licence, rather than a D365 one.
With all of the wonders and benefits that canvas apps brings, there still are some limitations. One of them I came across earlier today pertains to lookup fields.
Using Contact as an example, we see that ‘Currency’ is a lookup field:
When inserting a Gallery control, it’s possible to choose up to 3 fields to be displayed (depending on the layout selected). However, when we go set the value to a lookup field from the entity, they’re not there – it’s not possible to select a lookup field to be displayed. As you can see below, there’s no possibility to select ‘Currency’ (which we saw above):
I have no idea why Microsoft chose to do this, as it is possible to select a lookup field when connecting using a D365 datasource (though admittedly even then it only seems to work in limited situations, such as for Opportunities)
So, ways to work around it:
- Don’t! Accept the situation for what it is, and hope that Microsoft allows it in the future
- Create a custom text field for the entity. Create behaviour (eg with Flow, though keep in mind scalability of the solution and Flow run limits – you don’t want to be burning through all of them!) to copy the value of the lookup field to this new field (ensure that if the value is changed, it updates the custom field value as well). You can then use this field to be shown on the gallery control
- For lookup fields that are actually lookups (see item 4 below), it’s possible to change the ‘Text’ property for the field. Using the example above of Currency, the formula needed would be ‘LookUp(Currencies,’Currency Name’ = ThisItem.Currency.’Currency Name’).’Currency Name” (without the extra quotation marks). See left side image below for example of this
- For lookup fields that are actually of type ‘Customer’ (yup – special behaviour…thanks Microsoft!) there’s a different way that you’ll need to do this. You have to use the AsType function to declare the type (i.e. account) of the relationship (this can also work for Owner fields, where the owner can be a user or a team). The formula needed to show the Account name would be AsType(ThisItem.’Company Name’,[@Accounts]).’Account Name’. See right side image below for the example of this
I’d also like to give thanks to Jason Almeida for his help and assistance with finding solutions – he’s an amazing guy!
What are your thoughts on this?