cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hancha
Resolver I
Resolver 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
Resolver I
Resolver 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
Resolver I
Resolver 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)
);


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,859)