cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sabin-sh
Frequent Visitor

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

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

 

 

7 REPLIES 7
EricRegnier
Super User II
Super User II

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:

DianaBirkelbach
Super User
Super User

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

 

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

sabin-sh
Frequent Visitor

 

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 

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/vie...

Cheers 

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. 

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."

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (27,793)