Search code examples
wordpressdynamics-crmfetchxmlalexacrm-toolkit

How can I use Alexa CRM to display an aggregated result in WordPress


I'm currently using the Alexa CRM plugin for WordPress to connect to my Dynamics CRM. I'm trying to get the results of the following aggregation

[msdyncrm_twig]
{% fetchxml collection="simpleagg" cache="PT30M" %}
<fetch aggregate="true">
  <entity name="account">
    <attribute name="accountid" alias="AccountCount" aggregate="count" />
  </entity>
</fetch>
{% endfetchxml %}
{{simpleagg.results.entities[0].AccountCount}}
[/msdyncrm_twig]

This returns nothing. I tested this very same FetchXML query using XrmToolBox and it gave me the result I was expecting. I've tried {{simpleagg.results.entities[0].account}}, {{simpleagg.results.entities[0].accountid}}, and others, but I just can't figure out what I'm doing wrong. I can also handle views just fine. Does anyone have any idea on what I'm missing here.

Edit: I moved the {{simpleagg.results.entities[0].AccountCount}} into the [msdyncrm_twig] tag, but it's still not working.

2nd Edit: I am aware of the total record count field, but I will eventually need to get sums, mins, and maxes. I'll be working with complex FetchXML queries that won't be possible with views.


Solution

  • I asked the developers about this. I was using the Dynamics 365 plugin, but they recommended I use their Dataverse problem. I tried it, and it worked fine.