This project is read-only.

Problems with 'count' on Fetchxml request

Mar 31, 2016 at 4:41 AM
Hi.

First off just wanted to say "Thanks" for Easy Plugins. Its a very useful tool.

I'm having a problem with a new plugin I'm trying to set up. The function is quite simple:

I'm trying to find out on how many Account records a particular contact is the Primary contact and then update that contact record with the number of occurrences.

The plugin is set to 'Post Update' on the account entity.

I have created a new attribute (#p1) on the primarycontactId.

Then I create a Request with the following FetchXML:
<fetch count="50" >
  <entity name="account" >
    <filter type="and" >
      <condition attribute="primarycontactid" operator="eq" value="{#p1}" />
    </filter>
  </entity>
</fetch>
with the 'count' aggregate.

As soon as I validate that request and the dialog box closes, I am no longer able to add anything else (either attributes, requests) or actions (Create, update, delete, associate etc.)

I can click on the menu and the options are all there, but when I click on an option (like 'Update') nothing happens.

Any ideas?

Peter V.

(Using CRM 2015, on-premise)
Mar 31, 2016 at 10:33 AM
Hi petervr,

Thank you for using EasyPlugins,

I think the problem here is located on the request, EasyPlugins needs at least one attribute to "count" the lines.
Just add accountid attribute and try again.
<fetch count="50" >
  <entity name="account" >
    <attribute name="accountid" /> 
    <filter type="and" >
      <condition attribute="primarycontactid" operator="eq" value="{#p1}" />
    </filter>
  </entity>
</fetch>
Please let me know if it's ok for you :)

Amine
Mar 31, 2016 at 8:46 PM
That fixed it!

Thanks for your help!

Peter V.