This project is read-only.

Problem with Fetch

Mar 31, 2014 at 11:00 AM

I have the problem with the fetch. If I paste it in code, I recieve the mistake

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Object reference not set to an instance of an object.Detail:
<OrganizationServiceFault xmlns:i="" xmlns="">
<ErrorDetails xmlns:d2p1="">
  <d2p1:value xmlns:d4p1="" i:type="d4p1:string">0</d2p1:value>
  <d2p1:value xmlns:d4p1="" i:type="d4p1:string">-2146233088</d2p1:value>
<Message>Object reference not set to an instance of an object.</Message>
<InnerFault i:nil="true" />

[EasyPlugins: EasyPlugins.SynchronousPostUpdateStep]
[9fdef62f-16f3-e211-8a5d-080027865fa2: EasyPlugins.SynchronousPostUpdateStep: Update of any Entity]



<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_productsalesplan">
<attribute name="new_productsalesplanid" />
<attribute name="new_name" />
<attribute name="new_new_salelplanid" />
<order attribute="new_name" descending="false" />
<filter type="and">
  <condition attribute="new_salelplanid" operator="eq" uitype="new_salesplan" value="{#Id}"/>

Could you help me please?
Mar 31, 2014 at 12:02 PM

Is attribute 'new_new_salelplanid' correct on 'new_productsalesplan' entity ?

Mar 31, 2014 at 12:14 PM
Yes, it is OK.

Update: I think the problem is with combination of requests and attributes in one calculation. If I use only requests/ only attributes everything is OK. Are there restrictments?
I try to solve the task:
-fetch chiled entities using id of parent entity
-get the sum of fileds from child entities and save it in parent entity field.

for this issue I use fetch and parent entity attribute that stores final sum.
Apr 3, 2014 at 6:52 AM

You can have the sum directly from fetchxml by choosing only one numeric attribute on the fetchxml and choose Sum aggregation function (on the bottom of the page)