web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using Patch to create ...
Power Apps
Unanswered

Using Patch to create new D365 recird in an Model Driven Form embedded Canvas App

(0) ShareShare
ReportReport
Posted on by 55

am working within a Canvas App that is embedded on a Model Driven Form. I want to create new Work Order Products in a Work Order Form within an embedded Canvas App.

My Data Source for my embedded App is [@'Work Orders'] and I have a Gallery that is a collection of items to become new Work Order Products
ClearCollect(colProductsSelected,Filter(colAssetsSelected,!IsBlank(colAssetsSelected.msdyn_product.Name)))

The syntax for the On Select on a Button is the bellow

ForAll(
colAssetsSelected,
Patch('Work Order Products',Defaults('Work Order Products'),
{'Work Order':ModelDrivenFormIntegration.Item},
{Taxable:false},{Product:msdyn_product},
{Unit:msdyn_product.defaultuomid},
{Currency:msdyn_product.transactioncurrencyid},
{'Price List':msdyn_product.pricelevelid}));
Navigate(ScreenAuxiliary,ScreenTransition.Fade)

If I use the same (almost) code on a canvas app which is on the for as a Iframe, works like a charm. The drawback there is that it does not carry the Work Order Number so I have to look up and enter it again although I am in a form on that Work Order.

BUT the above code does not work - no errors, but it asks me for Unit Cost, then for Total Amount and much more. When I attempted to create Work Order Products with Flow, I encountered the same numerous required fields which should not be required in order to save a Work Order Product...
Please help....

Categories:
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @em_sc ,

     

    Did you mean that when you check the field settings, these fields actually are not set as Required?

     

    Regards,

    Mona

  • em_sc Profile Picture
    55 on at

    No, that is not what I meant. Let me try to explain it in a different way.

    I am creating new Work Order Products (D365) from a Canvas App. I am using an Iframe and web resource to embed the App on the Work Order Form in D365.

    In my Canvas App, when I add data sources through the D365 connector, the Patch function works perfectly :

    Patch('Work Order Products', Defaults('Work Order Products'), {}..)

    When I built a second app with the same functionality but setting up connection with CDS and CDS entities, my patch Function does not work anymore. I changed the syntax of fields accordingly, but in addition to the fields required in the D365 connection app, I am required to provide values for unit cost, Line Status and so on.

    The reason why I built the second app and connected to CDS is because in the App with the D365 connection I have a message popping up like: " You are using old Data Service connection, click here to learn more".

    Its almost like the CDS connector does not give me the functionality that D365 has in the background or I am not realizing the connection properly - I just read about Data Integration projects and sets and I did not do it that way.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
timl Profile Picture

timl 122 Super User 2026 Season 2

Last 30 days Overall leaderboard