cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
halifaxious
Resolver II
Resolver II

embedded canvas app ignores App.onStart

I have a 3 screen embedded canvas app that records the answers to questions. If all the questions have previously been answered and stored in Dataverse, the third screen should display. Otherwise, the app should start on the first screen.  I put this code in App OnStart:

ClearCollect(ResponseCollection,
Filter('PRA Scores',ThisRecord.'Primary Risk Assessment'.Activity=[@ModelDrivenFormIntegration].Item.Activity)
);
Set(saveable,IsEmpty(ResponseCollection));
If(!saveable,Navigate(RecommendationScreen,ScreenTransition.None));

If I play the app from canvas studio, it navigates to the 3rd screen as expected.  But when the app plays from inside my model-driven app, the 1st screen is always displayed.  How do I make my embedded canvas app behave as desired?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @halifaxious ,

 

I guess that the onstart property does not work because onstart is triggered before ModelDrivenFormIntegration].Item.Activity .

I suggest you use Timer control' OnTimeEnd property instead of Onstart property.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

View solution in original post

5 REPLIES 5
v-xiaochen-msft
Community Support
Community Support

Hi @halifaxious ,

 

I guess that the onstart property does not work because onstart is triggered before ModelDrivenFormIntegration].Item.Activity .

I suggest you use Timer control' OnTimeEnd property instead of Onstart property.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

ChadAlthaus
New Member

Another suggestion is to place all the logic depending on the ModelDrivenFormIntegration object into a hidden toggle control to avoid using an arbitrary timer. Matz Necker @matzzt has a great post on this suggestion: Quick Tip 💡 Embedded Canvas app - Data load problems in OnStart | nckr - blog 🚀

Thanks.  This is a better solution.

Has anyone noticed that when running the Toggle.OnChange "hack" the even it raised twice when canvas app is actually embedded in Dynamics.

 

I can repro this as a setup counter to increment every time OnChange is called. On the first load, it's always raised twice. If manually toggle the counter only increments by 1.

That solution works!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,198)