PowerApps: ModelDrivenFormIntegration control not available on App Start

Recently, we were working on embedded canvas app on Contact entity form. The requirement was to show related records of the Contact record based on certain condition when the App is started.

We created the App in make.powerapps.com and created an Azure Function which will take input as GUID of Contact record and will return the related records.

We used below formula on App –> OnStart:
Set(ClientID,[@ModelDrivenFormIntegration].Item.Contact);
Collect(RevenueCodes, AgedCareCoreTestFunction.ListRevenueCodes({clientid:ClientID}));

However, while testing it, checking the logs of Azure Function in Azure Portal, we found that ClientID is null.
Since, the input to the Azure Function was null, it was not doing any further processing and was returning null.

After spending some time on this issue, we were able to fix this issue by using a Timer control since ModelDrivenFormIntegration control is not available on App Start.

So, we used the below formula on TimerControl –> OnTimerEnd:
Set(ClientID,[@ModelDrivenFormIntegration].Item.Contact);
Collect(RevenueCodes, AgedCareCoreTestFunction.ListRevenueCodes({clientid:ClientID}));

Below are the properties of Timer Control that we set along with the above change:

  • Visible –> False
  • Duration(millisecond) –> 3000

By making the above changes, we were able to pass GUID of contact record to Azure Function and were able to see the related records in the collection.

Hope it helps !!

2 thoughts on “PowerApps: ModelDrivenFormIntegration control not available on App Start

  1. Hi,
    I usually do it in a quite similar way but with a shorter timer duration of 300ms. If the ID still empty I repeat the timer until it finally is available.
    I experienced scenarios where the ID of the record was available within 500ms but sometimes it takes a bit longer,

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.