locked
CRM 2013 Fect XML query SQL error RRS feed

  • Question

  • Hi All,

    I am getting the

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
        <entity name="insurancequotation" >
            <attribute name="a_policynumber" />
            <attribute name="a_totalprice" />
            <attribute name="a_insuranceproduct" />
            <order attribute="name" descending="false" />
            <link-entity name="a_salesbranch" from="a_name" to="a_salesbranchid" alias="acct" link-type="outer" > 
               </link-entity>

        </entity>
    </fetch>

     Entity Name : a_salesbranch,

    from attribute Name =a_name 

    To attribute ="a_salesbranchid"

    From attri butribute is single line textbox in salesbranch entit.

    To attribute is Lookup in  Quotation entity.

    Please suggest me what is reason am getting the below error

    InsuranceQuotes

    Wednesday, December 2, 2015 2:25 AM

All replies

  • The entity name "insurancequotation" cannot be correct. There is no system entity with this name, and any custom entity would have a prefix. Also, you cannot join between a text field and a lookup - the join has to be between the fields defined in the relationship.

    The simplest thing to do is use Advanced Find to build the query, then download the FetchXml


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Wednesday, December 2, 2015 12:05 PM
    Moderator
  • Hi Rammohan,

    Is it the same error you are getting for any query? Or only when run the above run?

    If it not for all and only for the mentioned, I would suggest to remove Link Entity first and test it.


    Gopinath


    My blog

    Wednesday, December 2, 2015 2:12 PM
  • Hi Gopi,

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >

        <entity name="mc_salesbranch" >

            <attribute name="mc_salesbranchid" />

            <attribute name="mcsuk_district" />

            <attribute name="mcsuk_area" />

            <attribute name="mcsuk_name" />

            <order attribute="mcsuk_name" descending="false" />

            <link-entity name="mcs_insurancequotation" from="mc_salesbranchid" to="mc_salesbranchid" alias="ac" >

                <attribute name="mc_insurancequotationid" />

                <attribute name="mcs_totalprice_base" />

                <attribute name="mc_totalprice/>

                <attribute name="mc_policynumber" />    

                <attribute name="mc_product"   />

                <filter type="or" >

                    <condition attribute="mc_applicationcompleteddate" operator="on-or-after" value="@FromDate" />

                    <condition attribute="mc_applicationcompleteddate" operator="on-or-before" value="@Todate" />

                </filter>

            </link-entity>

        </entity>

    </fetch>

    Here I have used the mc_product has  Matrix column (Pivot). now i want to set the each product how many policies  count.  instead of showing the policy numbers. 

    I have to set the policy total price each group wise.. can you please suggest it. how can i make it report wizard?

    Tuesday, December 8, 2015 2:02 AM