February 14, 2022

Dataverse REST Builder and FetchXML

In the last version of DRB I just published (1.0.0.31) I added a new tab FetchXML for the Retrieve Single and Retrieve Multiple request types:

You can't create a 1 to 1 conversion between Web API and FetchXML because the two query languages are not compatible (meaning you can usually do more stuff with FetchXML) but it's possible to convert some queries (FetchXML Builder has the option to export to Web API for a while now).

To be honest adding the FetchXML tab to DRB was only an exercise for me (and the generated code can be improved), I don't think someone will use my tool to generate FetchXML when there is FetchXML Builder (I am also an avid user of the tool).

However it allowed me to refresh a bit the FetchXML syntax and more important dealing with two aspects inside the XrmToolBox version:
  • Sending information from the web page to the container hosting the WebView2 component
  • Use the integration between tools offered by the IMessageBusHost interface
The first can be done using chrome.webview.postMessage from the web page and listening to the event WebMessageReceived inside the container.

The second utilizes the OnOutgoingMessage event, my friend Jonas Rapp wrote a page with some examples: Integrate with FetchXML Builder

If you are curious on how these things work you can check the code from this repository.

Leveraging this code, DRB can send the FetchXML code to FetchXML Builder when is executed inside XrmToolBox:
hope it helps!


0 comments:

Post a Comment