How can I implement custom FetchXML on a Dynamics 365 subgrid using JavaScript?

Dynamics 365 now uses different JS methods for custom FetchXML subgrids. How can I load appointment activities? Example:

var g = Xrm.Page.getControl('gridA');
if(!g)return; g.control.setParam('fetchXml','<fetch>...</fetch>'); g.control.refresh();

try using the addPreSearch event to set fetchxml before the grid loads. i had some luck with that method instead of directly setting parameters at runtime. ensure your custom xml is valid and cointains the proper filter for your appointmnts.