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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can you pass "bound" f...
Power Apps
Unanswered

Can you pass "bound" form properties to a dataset PCF control?

(0) ShareShare
ReportReport
Posted on by 27

Hi everyone, we have a dataset PCF control that needs to read a "totalCost" amount from a form, and update "totalAllocated" and "totalUnallocated" fields on the form. I'm trying to do this with bound properties, but the dataset control is not available (doesn't show up in CRM) as an option for the form's subgrid unless I change the bound parameters to input parameters.  If I do that, then only the initial field values from the form are passed in, and the PCF cannot update them...and changes to the "totalCost" field are not picked up by the PCF.

 

Do bound properties not work properly with dataset controls, or am I doing something wrong?

 

<manifest>
<control namespace="capsITK" constructor="ExpenditureAllocationGrid" version="0.0.41" display-name-key="ExpenditureAllocationGrid" description-key="ExpenditureAllocationGrid description" control-type="standard">
<data-set name="ExpenditureAllocationDataSet" display-name-key="Dataset_Display_Key">
</data-set>
<property name="totalCost" display-name-key="Total Cost" description-key="The field that holds the total allocatable cost" of-type="Decimal" usage="bound" required="true" />
<property name="totalAllocated" display-name-key="Total Allocated" description-key="The field that holds the calculated allocatable cost" of-type="Decimal" usage="bound" required="true" />
<property name="totalUnallocated" display-name-key="Total Unallocated" description-key="The field that holds the calculated unallocatable cost" of-type="Decimal" usage="bound" required="true" />
<property name="yearlyExpenditureFieldName" display-name-key="Yearly Expenditure Field Name" description-key="The name of the field that holds the yearly expenditure amounts" of-type="SingleLine.Text" usage="input" required="false" />
<property name="lockOnInactiveState" display-name-key="Lock on Inactive State" description-key="Lock the control if the state field is inactive true or false" of-type="SingleLine.Text" usage="input" required="false" />
<resources>
<code path="index.ts" order="1"/>
<css path="css/ExpenditureAllocationGrid.css" order="2" />
<resx path="strings/ExpenditureAllocationGrid.1033.resx" version="1.0.0" />
</resources>
<feature-usage>
<uses-feature name="WebAPI" required="true" />
</feature-usage>
</control>
</manifest>

 

I have the same question (0)
  • ScottDurow Profile Picture
    1,039 on at

    You cannot combine dataset and field controls - if your control is a dataset control it will only get the data from the grid it is bound to - if it's a field control - you cannot include dataset bindings.

  • Mike McGuinness_ Profile Picture
    27 on at

    Thanks Scott, I really appreciate you answering the question!  That's unfortunate, as it really handicaps a lot of scenarios where we could use PCFs to interact with child records, and potentially do custom roll-ups or interactions on the parent form.

     

    Hopefully the APIs improve the interactive capabilities over time!

     

    In the meantime, is there any way to tell the parent form data to refresh from the PCF?  Or to tell the PCF to refresh when a form input value changes?

  • ScottDurow Profile Picture
    1,039 on at

    There isn't currently a way of communicating between two PCFs - you would need to use a JS Webresources on the form and the grid context - https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/clientapi-grid-context

  • Ben Thompson Profile Picture
    1,400 on at

    @ScottDurow That's not quite true, bound input parameters can pass information between PCF field controls as that is the approach I use in all my backend metadata controls (the form usually starts with a select entity control which then passes the entity value into the child controls all of which have entity as a second input parameter).

     

    But there is no interaction between a subgrid / dataset control and the rest of the form as I don't think the dataset control is technically part of the form in the Unified interface world.

     

    @mikemcg Before I got sidetracked with something else and Scott stepped in I was going to ask why you need to use a Dataset control here. You could reverse your logic and create an input control and use a webapi request to retrieve the data you want. If you left the Subgrid in place you wouldn't even need to worry about displaying the data in the grid.

  • Mike McGuinness_ Profile Picture
    27 on at

    Hi @ben-thompson, the form contains fields for total cost, total allocated and total unallocated.

     

    The dataset PCF renders a series of sub-records, each with an editable field where the user can allocate the total cost across 5-10 projects or timespans.  The PCF is supposed to take the total cost as an input, allow the user to edit the yearly or project allocations, and roll-up the allocated/unallocated back to the parent record.  If the PCF supported bound properties for the control (don't see why it couldn't as the configuration spec seems to support it), as well as dataset bound properties, this would all work flawlessly.

     

    Going to see if the PCF can trigger a grid on change event, which would at least let me tell the form to refresh data.

  • ScottDurow Profile Picture
    1,039 on at

    @ben-thompson Thank you for clarifying.

     

    My comment was in context of my previous comment about dataset and field components not being able to communicate between each other using the PCF api. Certainly bound fields can be shared between components and so they can share the same data - but dataset can’t raise an event in a field component which is what this question seems to be about. I dare say there are plenty of non-API approaches that could be used which may by somewhat unsupported!

     

     

  • Mike McGuinness_ Profile Picture
    27 on at

    Hi @ScottDurow, about all I can seem to do is force the PCF dataset to refresh, catch the grid onLoad event on the form, and then force the form data to refresh.  Is this the best that can be done, or do you see any other options for passing data updates from dataset PCF to form without having to force-refresh both?

     

    ...at least in terms of supported approaches 😉

  • ScottDurow Profile Picture
    1,039 on at

    I think @ben-thompson is on the right track - using a field PCF to render the grid would probably make the most sense because you are then entirely inside the form context and can update the form fields accordingly.

  • Mike McGuinness_ Profile Picture
    27 on at

    Ahh, thanks @ScottDurow and @ben-thompson, I wasn't understanding Ben's suggestion correctly, but yes, that could work. But it becomes a bit more difficult to build it generically when it's not connected straight to a specific view. I think we're going to stick with a dataset for now, and display the Total/Allocated/Unallocated fields within the PCF.  If we end up needing form logic around Total/Allocated/Unallocated, I'll have to trigger the grid load event from the PCF, and pick that up on the form.

  • Ben Thompson Profile Picture
    1,400 on at

    It's probably obvious but don't forget that after hiding the Total / Allocated / Unallocated fields on the form you can use the Webapi to update the core record in the background. The link was open so you can find it at https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/webapi/updaterecord but you will need to enable the WebApi feature (I mention that as I've forgotten to do that more than once in the past).

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard