convert query to fetchxml RRS feed

  • Question

  • hi how can i convert this query to fetchxml expression?

    i want to count a contact's website if contact has a website i want to give a message on load event

    select c.ContactId,
     COUNT(w.new_websiteId)  from contact C

    inner join new_website W on W.new_ContactId=c.ContactId

    where w.statecode=0
     group by c.ContactId

    thx for answers

    Crm Software Specialist

    Tuesday, May 8, 2012 2:52 PM


All replies

  • If you can write with query in LNQ, then you can use LINQPad to FetchXML. Check this link:


    Tuesday, May 8, 2012 3:21 PM
  • hi,

    go to advance find , select the entity records you want to see along with the condition. run this and then download the xml you will get this option in the advance find itself.

     once you get this done then do the count record stuff on the gathered records.

    you can also join the entitis as you require in advance find..

    Hope this helps, if this works for you kindly mark the answer .



    Tuesday, May 8, 2012 3:39 PM
  • hi,

    I think you query bit like this

    <fetch aggregate='true' distinct="false" no-lock="false" mapping="logical"><entity name="contact" enableprefiltering="1" prefilterparametername="CRM_FilteredContact"><attribute name="new_websiteId" aggregate='count' alias="WebId" />

    <link-entity name="new_website" from="new_ContactId" to="contactid" visible="false" intersect="true">


    Wednesday, May 9, 2012 9:53 AM
  • solved by using fetcxml method


    Crm Software Specialist

    Thursday, May 10, 2012 6:35 AM