Filter account on parent account fields

Jan 29, 2013 at 2:24 PM

Hi there

First of all let me say this tool is excellent.

I'm try to show a list of accounts that have a particular parent account associated with them. I've generated the FetchXML in the views and the conditions that I cut and paste to the config file is as follows: -

      <condition attribute="statecode" operator="eq" value="0" />
      <condition attribute="customertypecode" operator="eq" value="1" />
      <condition attribute="new_invoicee" operator="in">
        <value uiname="Parent name 1" uitype="account">{CEFAB5AB-C69C-E011-997C-1CC1DE6D3B23}</value>
        <value uiname="Parent name 2" uitype="account">{186F81D9-B3A8-E111-B6E9-1CC1DE6D3B23}</value>
        <value uiname="Parent name 3" uitype="account">{78E4771E-B2A8-E111-B6E9-1CC1DE6D3B23}</value>
      </condition>

Of course I'm getting an error when the map shows. If I take out the third condition which filters on the parents all the accounts show as expected so I know it is this condition line that is causing the problem.

Can you possibly point me in the right direction to sort this please?

Regards
Paul

Jan 29, 2013 at 2:26 PM

Just to add, this is the <FetchXml> section in full in case you can see what the error might be here

    <fetchXml>
    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="account">
        <attribute name="name" />
        <attribute name="address1_city" />
            <attribute name="websiteurl" />
        <attribute name="primarycontactid" />
            <attribute name="address1_latitude" />
            <attribute name="address1_longitude" />
        <attribute name="telephone1" />
        <attribute name="new_managedbyentity" />
        <attribute name="new_invoicee" />
        <attribute name="new_currentissuecount" />
        <attribute name="new_propertyid" />
        <attribute name="parentaccountid" />
        <attribute name="accountid" />
        <order attribute="name" descending="false" />
        <filter type="and">
      <condition attribute="statecode" operator="eq" value="0" />
      <condition attribute="customertypecode" operator="eq" value="1" />
      <condition attribute="new_invoicee" operator="in">
        <value uiname="Parent name 1" uitype="account">{CEFAB5AB-C69C-E011-997C-1CC1DE6D3B23}</value>
        <value uiname="Parent name 2" uitype="account">{186F81D9-B3A8-E111-B6E9-1CC1DE6D3B23}</value>
        <value uiname="Parent name 3" uitype="account">{78E4771E-B2A8-E111-B6E9-1CC1DE6D3B23}</value>
      </condition>
        {0}
        {1}
        </filter>
        <link-entity name="account" from="accountid" to="parentaccountid" visible="false" link-type="outer" alias="accountparentaccountidaccountaccountid">
          <attribute name="name" />
        </link-entity>
      </entity>
    </fetch>
    </fetchXml>

Coordinator
Jan 30, 2013 at 3:49 AM

How did you create this fetchxml. Using Advanced find or you're sure that it is correct.

Could you please also debug the bing map browser by adding "debug" flag:

Enable minimal debugging: In the Web resource properties dialog(while adding on Dashboard or form), just set Custom Parameter(data) to "debug" (quotes only for clarity). Then publish the changes.

Share your findings and if it doesn't solve the problem, I'll try in my local env.

Feb 1, 2013 at 1:51 PM
HI there

Thanks for the reply.

Yes, I created the fetchxml using the Advanced find.

When I add the debug parameter it works OK up to the following error

Error loading the entities. Make sure you are online. Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

Any ideas?

Thanks
Paul
Coordinator
Feb 2, 2013 at 4:18 AM
Make sure Conditions node in xml is correctly declared. There needs to be 1:1 mapping with the placeholders in fetchXml. Example:

<Conditions>
  <mapcondition text="Name Contains: ">
    <condition attribute="name" operator="like" value="%{0}%" />
    <value type="string" default=""></value>
  </mapcondition>
  <mapcondition text="City: ">
    <condition attribute="address1_city" operator="like" value="%{0}%" />
    <value type="string" default=""></value>
  </mapcondition>
</Conditions>
Feb 4, 2013 at 1:55 PM
Hi there

OK, I've copied the full FecthXML here for you to see and the error I am getting with this code is

"Error loading the entities. Make sure you are online. Input string was not in a correct format."

I've replaced 3 strings that hold the actual names of some entities for privacy reasons for this post.

Thanks again for any help.

<entities>
<globalsettings>
<defaultMapLocation Center="53.63668, -1.66497" ZoomLevel="6" />
<nearDistanceUnit value="miles" />
</globalsettings>
<entity name="account" displayname="Site">
<fetchXml>
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="account">
    <attribute name="name" />
    <attribute name="address1_city" />
    <attribute name="websiteurl" />
    <attribute name="primarycontactid" />
    <attribute name="address1_latitude" />
    <attribute name="address1_longitude" />
    <attribute name="telephone1" />
    <attribute name="new_managedbyentity" />
    <attribute name="new_invoicee" />
    <attribute name="new_currentissuecount" />
    <attribute name="new_propertyid" />
    <attribute name="parentaccountid" />
    <attribute name="accountid" />
    <order attribute="name" descending="false" />
    <filter type="and">
  <condition attribute="statecode" operator="eq" value="0" />
  <condition attribute="customertypecode" operator="eq" value="1" />
  <condition attribute="new_invoicee" operator="in">
    <value uiname="xxxxxxxxxxxxxxxxxx" uitype="account">{CEFAB5AB-C69C-E011-997C-1CC1DE6D3B23}</value>
    <value uiname="yyyyyyyyyyyyyyyyy" uitype="account">{186F81D9-B3A8-E111-B6E9-1CC1DE6D3B23}</value>
    <value uiname="zzzzzzzzzzzzzzzzzzzzzzzz" uitype="account">{78E4771E-B2A8-E111-B6E9-1CC1DE6D3B23}</value>
  </condition>
      {0}
      {1}
    </filter>
    <link-entity name="contact" from="contactid" to="primarycontactid" visible="false" link-type="outer" alias="accountprimarycontactidcontactcontactid">
      <attribute name="emailaddress1" />
    </link-entity>
  </entity>
</fetch>
</fetchXml>
<address>
  <latitude name="address1_latitude"></latitude>
  <longitude name="address1_longitude"></longitude>
</address>
<Conditions>
  <mapcondition text="Name Contains: ">
    <condition attribute="name" operator="like" value="%{0}%" />
    <value type="string" default=""></value>
  </mapcondition>
  <mapcondition text="City: ">
    <condition attribute="address1_city" operator="like" value="%{0}%" />
    <value type="string" default=""></value>
  </mapcondition>
</Conditions>
<displaypanel>
  <links>
  </links>
  <list>
    <listitem text="Name">
      <field name="name"></field>
    </listitem>
    <listitem text="City">
      <field name="address1_city"></field>
    </listitem>
    <listitem text="Invoicee">
      <field name="new_invoicee"></field>
    </listitem>
  </list>
  <tooltip text="Name">
    <field name="name"></field>
    <color name="blue"></color>
    <zoomlevel name="10"></zoomlevel>
  </tooltip>
</displaypanel>
</entity>
</entities>
Coordinator
Feb 5, 2013 at 12:59 PM
Looks fine to me, though I cannot test since it has some new fields which doesn't exist OOB.
Have you looked at fiddler traces? Fiddler traces should contain the actual response for loading records call. This response should've detailed description about the issue.

Thanks,
Atul