Embedded Canvas Apps

Challenge #7: Testing logic in the app designer

Challenge #7

While one of the best practices is to never test an embedded canvas app within the app designer, it is sometimes beneficial to do so just to test out the logic. Since embedded canvas apps work off of a contextual record, it is sometimes not easy to review the logic within the designer especially when it comes to related records. For example, for an embedded canvas app tied to the Accounts entity, there might be a test Account that might be your preferred account for testing. That test account may be the only one which has lots of test data especially when it comes to related entity records.

Trick #7

It helps to test out an embedded canvas app using a specific record of your choice. If that is the case, any references to the contextual record can be replaced with code that hard codes the GUID to the record of your choice.

Replace

[@ModelDrivenFormIntegration].Item.Contacts

with

LookUp(Accounts, 'Account Name' = "Fabrikam, Inc. (Sample)") .Contacts

Another point to keep in mind is that the default record within an embedded canvas app is the first record of the entity to which the app is tied to. For example, in an Accounts embedded app, the default record (when you create/open an embedded app) is First(Accounts). So if you haven't created test data, it might be helpful to create your test data for this record (keep in mind that this may not be the first record in a view within the model-driven app).

Here is a view of all active accounts.

My Active Accounts view

However, this is the default record in the Accounts embedded canvas app.

ModelDrivenFormIntegration item

Have fun! Get addicted!

1 thought on “Challenge #7: Testing logic in the app designer”

Leave a Reply