cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hancha
Helper I
Helper I

Canvas app does not catch plug-in exception on SubmitForm

Hi, 
I wonder if anyone could help me with the following:

When I use SubmitForm I don´t get any error message about plug-in exception but when using Patch I do.

My context:

I have an embedded canvas app on Dynamics 365 form (Opportunity entity); all working above Dataverse.
The app consists of several Edit Forms with fields and a submit button.
The app settings has Formula-level Error Mangement = ON.

My scenario:
On data submit the app fills in fields in the Opprotunity entity, at the same time a plug-in launches and compares all relevant Opportunity form data (not only the app fields) against a reservation system (outside of Dynamics). If there is some discrepancy the plug-in returns an exception but my app "swallows" it when using SubmitForm function. 

When I tried using Patch instead of SubmitForm I got the system message telling me about data discrepancy when communication with the reservation system (see the pic).

Unfortunately Patch functions are a bit tedious to write and it makes fileds validations more tedious...
So my question is:
What is the reason for this kind of behaviour?
Can I make SubmitForm works the same way as Patch?

Thanks a lot
Hancha

1 ACCEPTED SOLUTION

Accepted Solutions
Hancha
Helper I
Helper I

My question still stands but I´ve come up with a working workaround, combining Patch and Submit so I can use all the advantages of both 😉

I´m checking the Valid property of the form and If valid I go for Patch, if not I´ll run SubmitForm, which highlights all the incorrectly filled fields...

Something like this:
If(
MyForm.Valid
),
Patch(
Opportunities,
LookUp(
Opportunities,
OpportunityID = [@ModelDrivenFormIntegration].Item.OpportunityID),
{
'Column1Name': DataCardValueXY.Selected.Value,
'Column2Name': DataCardValueYZ.Text,
etc...
}
);
Navigate(SuccessScreen),
SubmitForm(MyForm)
);


View solution in original post

1 REPLY 1
Hancha
Helper I
Helper I

My question still stands but I´ve come up with a working workaround, combining Patch and Submit so I can use all the advantages of both 😉

I´m checking the Valid property of the form and If valid I go for Patch, if not I´ll run SubmitForm, which highlights all the incorrectly filled fields...

Something like this:
If(
MyForm.Valid
),
Patch(
Opportunities,
LookUp(
Opportunities,
OpportunityID = [@ModelDrivenFormIntegration].Item.OpportunityID),
{
'Column1Name': DataCardValueXY.Selected.Value,
'Column2Name': DataCardValueYZ.Text,
etc...
}
);
Navigate(SuccessScreen),
SubmitForm(MyForm)
);


View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (61,917)