Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Invalid Argument in FetchCollection

Posted on by

I am editing a chart and trying to set fetch filter parameters.  The condition field I want to use is 'ext_qtr' which is an option set with four values (Q1, Q2, Q3, Q4).  Below is my XML, however, when I try and reimport back into CRM I am getting an "Invalid Argument" error.   I can change these conditions to go by a date field and date range, or even change the value to just (1,2,3,4) and the chart imports (just gives me incorrect data because it's not what I'm looking for).  

This is also based on a custom entity we have "ext_Contract"

We are on CRM 2015 OnPrem (not SP1)

<visualization>
  <visualizationid>{6C25D02F-2D16-E711-80CD-40A8F0219EFB}</visualizationid>
  <name>Contract MRC by Fiscal Qtr</name>
  <primaryentitytypecode>ext_contract</primaryentitytypecode>
  <datadescription>
<datadefinition>
      <fetchcollection>
        <fetch mapping='logical' aggregate='true'>
          <entity name='ext_contract'>
            <attribute name='ext_servicetype' groupby='true' alias='ServiceType' />
            <link-entity name='ext_contract' from='ext_contractid' to='ext_contractid' link-type='outer'>
              <attribute alias='Q1' name='ext_contractmrc' aggregate='sum' />
              <filter type='and'>
                <condition attribute='ext_qtr' operator='eq' value='Q1' />
              </filter>
            </link-entity>
            <link-entity name='ext_contract' from='ext_contractid' to='ext_contractid' link-type='outer'>
              <attribute alias='Q2' name='ext_contractmrc' aggregate='sum' />
              <filter type='and'>
                <condition attribute='ext_qtr' operator='eq' value='Q2' />
              </filter>
            </link-entity>
            <link-entity name='ext_contract' from='ext_contractid' to='ext_contractid' link-type='outer'>
              <attribute alias='Q3' name='ext_contractmrc' aggregate='sum' />
              <filter type='and'>
                <condition attribute='ext_qtr' operator='eq' value='Q3' />
              </filter>
            </link-entity>
            <link-entity name='ext_contract' from='ext_contractid' to='ext_contractid' link-type='outer'>
              <attribute alias='Q4' name='ext_contractmrc' aggregate='sum' />
              <filter type='and'>
                <condition attribute='ext_qtr' operator='eq' value='Q4' />
              </filter>
            </link-entity>
            <attribute name='ext_contractmrc' aggregate='sum' alias='Total' />
          </entity>
        </fetch>
      </fetchcollection>
    <categorycollection>
        <category alias='ServiceType'>
        <measurecollection>
            <measure alias='Q1' />
        </measurecollection>
        <measurecollection>
            <measure alias='Q2' />
        </measurecollection>
        <measurecollection>
            <measure alias='Q3' />
        </measurecollection>
        <measurecollection>
            <measure alias='Q4' />
        </measurecollection>
        <measurecollection>
        <measure alias='Total' />
        </measurecollection>
        </category>
    </categorycollection>
</datadefinition>
</datadescription>
<presentationdescription>
<Chart Palette='None' PaletteCustomColors='55,118,193; 197,56,52; 149,189,66; 117,82,160; 49,171,204; 255,136,35; 97,142,206; 209,98,96; 168,203,104; 142,116,178; 93,186,215; 255,155,83'>
    <Series>
        <Series ChartType='Stackedbar' LegendText='Q1' Color='DarkBlue' IsValueShownAsLabel='False' Font='{0}, 9.5px' LabelForeColor='59, 59, 59' CustomProperties='PointWidth=0.75, MaxPixelPointWidth=40'></Series>
        <Series ChartType='Stackedbar' LegendText='Q2' Color='RoyalBlue' IsValueShownAsLabel='False' Font='{0}, 9.5px' LabelForeColor='59, 59, 59' CustomProperties='PointWidth=0.75, MaxPixelPointWidth=40'></Series>
        <Series ChartType='Stackedbar' LegendText='Q3' Color='CornflowerBlue' IsValueShownAsLabel='False' Font='{0}, 9.5px' LabelForeColor='59, 59, 59' CustomProperties='PointWidth=0.75, MaxPixelPointWidth=40'></Series>
        <Series ChartType='Stackedbar' LegendText='Q4' Color='LightSteelBlue' IsValueShownAsLabel='False' Font='{0}, 9.5px' LabelForeColor='59, 59, 59' CustomProperties='PointWidth=0.75, MaxPixelPointWidth=40'></Series>
        <Series ChartType='Bar' IsVisibleInLegend='False' IsValueShownAsLabel='True' LabelFormat='$#,#,#' Color='Transparent' Font='{0}, 14px' LabelForeColor='59, 59, 59'></Series>
    </Series>
    <ChartAreas>
<ChartArea BorderColor='White' BorderDashStyle='Solid'>
    <AxisY LabelAutoFitMinFontSize='8' TitleForeColor='59, 59, 59' TitleFont='{0}, 10.5px' LineColor='165, 172, 181' IntervalAutoMode='VariableCount'>
        <MajorGrid LineColor='239, 242, 246' />
        <MajorTickMark LineColor='165, 172, 181' />
        <LabelStyle Font='{0}, 10.5px' Format='$#,#,k' ForeColor='59, 59, 59' />
        </AxisY>
    <AxisX LabelAutoFitMinFontSize='8' TitleForeColor='59, 59, 59' TitleFont='{0}, 10.5px' LineColor='165, 172, 181' IntervalAutoMode='VariableCount'>
        <MajorTickMark LineColor='165, 172, 181' />
        <MajorGrid LineColor='Transparent' />
        <LabelStyle Font='{0}, 10.5px' ForeColor='59, 59, 59' />
        </AxisX>
</ChartArea>
</ChartAreas>
<Titles>
    <Title Alignment='TopLeft' DockingOffset='-3' Font='{0}, 13px' ForeColor='59, 59, 59'></Title>
</Titles>
<Legends>
    <Legend Alignment='Center' LegendStyle='Table' Docking='right' IsEquallySpacedItems='True' LegendItemOrder='ReversedSeriesOrder' Font='{0}, 11px' ShadowColor='0, 0, 0, 0' ForeColor='59, 59, 59' />
</Legends>
</Chart>
</presentationdescription>
<isdefault>false</isdefault>
</visualization>

*This post is locked for comments

  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    Gopalan Bhuvanesh 11,397 on at
    RE: Invalid Argument in FetchCollection

    FetchXML Query looks alright.

    You modified only the fetchxml?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans