2

Is it possible to patch a Data Source, like SharePoint from inside a Component?

I got multiple screens in my app with many fields, clicking save from one screen should save everything from other screens.

I'm trying to have a component with a button so that when I need to do changes to the save functionality I only have 1 place to change and not in all the screens.

1
  • This look that the Button with the Patch-function is not in the component. Is that correct?
    – Olli
    Jan 9, 2021 at 21:08

2 Answers 2

1

You can't save data sources, forms, and data tables with components.

Source: Create a component for canvas apps - Known limitations

It is an known limitation with Component control in Power Apps. The data source you added in your app could not be recognized within the Component control.

If you want to execute the Patch formula within your Component control, I afraid that there is no way to achieve your needs in Power Apps currently.

Reference: Components - work around no data source access

If you would like this feature to be added in Power Apps, please vote this idea on Power Apps Ideas Forum: Allow access to data source from within components

1
  • 1
    Thought so! Thanks for the sources Aug 21, 2020 at 4:41
0

Ganesh may be overlooking the ability to define custom properties in the component. You can 100% patch a Data Source like SharePoint from inside a Component. For each field you wish to patch (whether it is an insert or update), define an output property.

Then on the app side, your patch command will resemble something similar to the following example (an actual in-production example):

    Patch(
    tblResources,
    LookUp(tblResources, ResourcePK = First(colResource).ResourcePK), 
    {
    Title: 'comResourceInfo-S920'.Title,
    Description: 'comResourceInfo-S920'.Description,
    UNC: 'comResourceInfo-S920'.UNC,
    URL: 'comResourceInfo-S920'.URL,
    Active: 'comResourceInfo-S920'.Active,
    bump: 'comResourceInfo-S920'.Bump,
    RsrcTypeFK: 'comResourceInfo-S920'.RTypeFK,
    ToolFK: 'comResourceInfo-S920'.ToolFK,
    StatusFK: 'comResourceInfo-S920'.StatusFK,
    BPO_L0_FK: 'comResourceInfo-S920'.BPO0,
    BPO_L1_FK: 'comResourceInfo-S920'.BPO1,
    BPO_L2_FK: 'comResourceInfo-S920'.BPO2
})

My component is comResourceInfo. When I add the component to the screen, it is referred to as comResourceInfo-S920. All of the output properties that I defined in the component are available within that element and referred to as shown following the dot notation in the patch function above.

The screen has a save button to execute the patch. And that's is how you patch a Data Source like SharePoint from inside a Component.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.