Opening a Dataverse record in a canvas app vs a model-driven app on mobile
A Dataverse table usually has multiple columns and it may not be the best idea to show all columns in a canvas app. For example, opening a record (say, an Account) on a canvas app will typically be very different from opening it in a model-driven app.
The problem - Opening a Dataverse record in a model-driven app from a canvas app (opens in web)
When you open a record in a model-driven app on web, you can fetch the URL of that record:
https://org089767a0.crm.dynamics.com/main.aspx?appid=40be1251-58f2-ea11-a815-000d3a9a0966&pagetype=entityrecord&etn=account&id=4f65b4e4-e7ad-ea11-a816-000d3a579b83
Without getting too much detail of how to fetch these in a canvas app, the key point here is that the last GUID in the URL above is the GUID of the record we want to open. So, if you want to open a record in a model-driven app from a canvas app, set the OnSelect of a button to the following code:
Launch(
"https://org089767a0.crm.dynamics.com/main.aspx?appid=40be1251-58f2-ea11-a815-000d3a9a0966&pagetype=entityrecord&etn=account&id=" & locSelectedAccount.Account,
{},
LaunchTarget.New
)
where locSelectedAccount is set when an Account is selected from the gallery of accounts. The problem with this approach is that it opens the model-driven app in a browser on the user's mobile device.
To learn more about the Launch function, click here.
The solution - Opening a Dataverse record in a model-driven app mobile app from a canvas app
The solution is to change the Launch URL slightly as shown below:
Launch(
"ms-apps://org089767a0.crm.dynamics.com_40be1251-58f2-ea11-a815-000d3a9a0966?tenantId=7a3e2b24-01c5-4282-a3b6-895c624db153&isShortcut=true&appType=AppModule&openApp=true&restartApp=true&forceOfflineDataSync=true&pagetype=entityrecord&etn=account&id=" & locSelectedAccount.Account,
{},
LaunchTarget.New
)
Here is a quick demo: