Optionset contains following values:
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.
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:
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?
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.
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:
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.
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."
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.