Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

How to use the entity(records) return by odata query or fetchxml into PCF dataset

(0) ShareShare
ReportReport
Posted on by 4

Hello Everyone,

 

Scenario:
Optionset contains following values:
1. Baseball
2. Basketball
Subgrid records should be:
if baseball is selected , display records from "XYZ" entity where "field1"=accountid or field2=accountid and

if "Basket ball" is select, display records from "XYZ" entity where field1=accountid.

 

I need to use custom fetchxml in subgrid. So I thought of creating a PCF dataset control.

 

I searched in so many places but i cannot find a way or example to map the fetchxml result to dataset columns. I can add columns to the dataset but how do i assign a value to dataset columns that i get from the result of FetchXML.

Is it possible to do so?

I am new to PCF control and would really appreciate help.

Best Regards

 

 

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: How to use the entity(records) return by odata query or fetchxml into PCF dataset

    Hi @sabin-sh , 

    Maybe is a little late for you, but might still help for the future: with a dataset PCF you can take the view that was set by the customizer, and add some more filter. You don't need to hardcode a fetchXml.

    Maybe my blog about dataset PCF might help: seamless integration , extensibility (here is an example of filter on top of the defined view), and multiple datatsets .

     

    Best regards,
    Diana
    ----------
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • sabin-sh Profile Picture
    4 on at
    Re: How to use the entity(records) return by odata query or fetchxml into PCF dataset

    I created a custom subgrid(not dataset) using PCF and use fetchxml as I could not find a way to inject fetchxml in dataset. I needed a dynamic query so I built one. 

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on at
    Re: How to use the entity(records) return by odata query or fetchxml into PCF dataset

    Hi @sabin-sh,

    SetParameter was still unsupported in classic, although that worked. If you can get away with the 2nd filter on agencyname, then you can configure 2 views (one per client type) and then on load or on change of the client type change the view with setCurrentView function:

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/grids/viewselector/setcurrentview

    Cheers 

  • sabin-sh Profile Picture
    4 on at
    Re: How to use the entity(records) return by odata query or fetchxml into PCF dataset
     

    Hello @EricRegnier@DianaBirkelbach 
     

    Thank you for your response.


    I am sorry i could not explain the situation properly. I did not mean to talk about view for lookup field.

     

    I have a subgrid in account form. That subgrid display the records depending on what is selected as a client type.  If client type is 'A' then use fetchxml to get the records based on condition accountid = accountid or accountid = agencyname. If Client type is 'B' then use fetchxml to get the records based on condition accountid = accountid. In D365 classic Interface we could inject  fetchxml  using Grid.control.SetParameter("fetchXML",fetchXml); grid.control.refresh(); but in UCI version this is not supported.


    I want to achieve same goal for UCI. I could create the html table and display the records but i need those features offered by subgrid/(PCF dataset).

     

    Is there a way to do so ?  I would really appreciate.

     

    Best Regards,

     

    How to use the entity(records) return by odata query or fetchxml into PCF dataset 

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on at
    Re: How to use the entity(records) return by odata query or fetchxml into PCF dataset

    @DianaBirkelbach you’re right they’re for lookups, not for subgrids!

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: How to use the entity(records) return by odata query or fetchxml into PCF dataset

    HI @sabin-sh , 

    My first approach would be, not to use an own fetchXml, but to make use of the filter method on the provided dataset: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/dataset#filtering. But I have to admit that I haven't tried it out yet. Maybe somebody else might know more about this.

     

    In case the filter approach doesn't work, I wouldn't make a dataset PCF, since then you actually don't use the dataset features. Then I would even try to use a field type pcf: bound to the optionset property that you have the dependency on. The rest you have to implement on your own anyway (except the Commandbar, ViewSelector and QuickFindSearch that you could activate only for a dataset pcf, but you can use them only if you don't use your own fetchXML)

     

    @EricRegnier The addCustomView and addCustomFilter are only Lookup methods. I am pretty sure they are unsupported for a subgrid control. If you used them a lot, I would like to know is you had trouble in the last years using them. I think there was a change in CRM 2013, but did you had any trouble using them after that?

     

    Best regards,

    Diana

     

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on at
    Re: How to use the entity(records) return by odata query or fetchxml into PCF dataset

    Hi @sabin-sh,

    You don't necessarily need a PCF control for this. You can use the out-of-the-box subgrid with addCustomFilter or addCustomView (if you want dynamic columns) functions from the client API:

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 72 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

Overall leaderboard