Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 26 04:02
    dependabot[bot] labeled #580
  • Oct 26 04:02
    dependabot[bot] opened #580
  • Oct 26 04:02
    dependabot[bot] labeled #579
  • Oct 26 04:02

    dependabot[bot] on nuget

    Bump Microsoft.CrmSdk.XrmToolin… (compare)

  • Oct 26 04:02
    dependabot[bot] opened #579
  • Oct 26 04:02

    dependabot[bot] on nuget

    Bump Microsoft.CrmSdk.XrmToolin… (compare)

  • Oct 20 19:41
    rappen commented #578
  • Oct 20 19:31
    MatthewTheRaven commented #578
  • Oct 20 19:28
    MarkMpn commented #578
  • Oct 20 19:10
    rappen commented #578
  • Oct 20 18:14
    MatthewTheRaven commented #578
  • Oct 20 18:12
    MatthewTheRaven commented #578
  • Oct 20 18:09
    MatthewTheRaven opened #578
  • Oct 13 04:03
    dependabot[bot] labeled #577
  • Oct 13 04:03
    dependabot[bot] opened #577
  • Oct 13 04:03

    dependabot[bot] on nuget

    Bump Microsoft.NETCore.Platform… (compare)

  • Oct 12 13:26

    rappen on master

    Change meta Create, Update, Cus… Merge branch 'master' of https:… (compare)

  • Oct 11 18:43
    rappen assigned #556
  • Oct 11 18:43
    rappen reopened #556
  • Oct 11 18:43
    rappen commented #556
Jonas Rapp
@rappen
Indeed it is.... Dare we hope for it in v10 ? :smirk:
ryanmortfield
@ryanmortfield
Hi, question: Is it possible to generate a somewhat conditional fetchxml? There are two contact lookups on account, contact1 and contact2. I want to return all accounts where contact1 does not have a certain status, and where contact2 also does not have a certain status. But contact2 can potentially be null. Is this possible in one query or am I stuck doing multiple?
Jonas Rapp
@rappen
Hi Zaphod! It should be possible, will try to compose an example. Pls hold.
Something like this?
<fetch>
  <entity name='account' >
    <attribute name='name' />
    <filter type='and' >
      <condition entityname='C1' attribute='statuscode' operator='neq' value='1' />
      <filter type='or' >
        <condition entityname='C2' attribute='contactid' operator='null' />
        <condition entityname='C2' attribute='statuscode' operator='neq' value='1' />
      </filter>
    </filter>
    <link-entity name='contact' from='contactid' to='new_contactid1' link-type='inner' alias='C1' />
    <link-entity name='contact' from='contactid' to='new_contactid2' link-type='outer' alias='C2' />
  </entity>
</fetch>
ryanmortfield
@ryanmortfield
Hi Jonas, thanks for the reply! Unfortunately it doesn't quite work. Apologies for explaining poorly maybe. The case I'm having the most trouble with is: If contact1 has a status eq1 but contact2 of the same account has neq1, that account should be returned.
Jonas Rapp
@rappen
Ah.... no, comparing two fields is not possible. One of the major downsides of FetchXML in my opinion...
miller1976
@miller1976

Hi Jonas,

Running version 1.2018.2.2 and I have this query, but the QueryBuilder has trouble understanding the rowaggregate attribute. Maybe a fix in a future version?

´´´

<fetch distinct="false" no-lock="false" mapping="logical" page="1" count="250" returntotalrecordcount="true" >
<entity name="account" >
<attribute name="name" />
<attribute name="address1_city" />
<attribute name="primarycontactid" />
<attribute name="telephone1" />
<attribute name="accountid" />
<attribute name="processid" />
<attribute name="name" />
<attribute name="telephone1" />
<attribute name="address1_city" />
<attribute name="primarycontactid" />
<attribute name="parentaccountid" alias="HierarchyDataParentID6dcd9e4c001441b09237d51a34853d55" />
<attribute name="accountid" alias="HierarchyDataChildCount6dcd9e4c001441b09237d51a34853d55" rowaggregate="CountChildren" />
<filter type="and" >
<condition attribute="ownerid" operator="eq-userid" />
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<order attribute="name" descending="false" />
<link-entity name="contact" to="primarycontactid" from="contactid" link-type="outer" alias="accountprimarycontactidcontactcontactid" >
<attribute name="emailaddress1" />
</link-entity>
<link-entity name="workflow" to="processid" from="workflowid" link-type="outer" alias="processidworkflowworkflowid" >
<attribute name="versionnumber" />
</link-entity>
</entity>
</fetch>
´´´

Jonas Rapp
@rappen
Hi Miller
How did you compose that query? According to the FetchXML specs, the RowAggregate attribute is only available for the condition node in the query, and not for the attribute node.
miller1976
@miller1976
Hi Jonas,The fetchXML is taken from a view in CRM. So I guess this is MS composed.

If you run this query it actually executes, so the innards of CRM has support for the RowAggregate on the attribute node.

More precisely the fetch was taken from an out-of-the-box "Active Accounts" view.

Jonas Rapp
@rappen
That's really strange, since their own schema does not allow it...
But you're right, the query executes fine. You can do it by clicking Execute below the fetchxml window, then the query is not validated against the schema. I will bring this up with the team at MS.
However the Active Accounts view in a brand new environment (9.0.1.569) looks like this:
<fetch version='1.0' output-format='xml-platform' mapping='logical' >
  <entity name='account' >
    <attribute name='name' />
    <attribute name='address1_city' />
    <order attribute='name' descending='false' />
    <attribute name='primarycontactid' />
    <attribute name='telephone1' />
    <filter type='and' >
      <condition attribute='statecode' operator='eq' value='0' />
    </filter>
    <link-entity alias='accountprimarycontactidcontactcontactid' name='contact' from='contactid' to='primarycontactid' link-type='outer' visible='false' >
      <attribute name='emailaddress1' />
    </link-entity>
    <attribute name='accountid' />
  </entity>
</fetch>
If I can reproduce / find the query you mention, I will have a case with MS.
KiranM
@mittapallikiran
Hi All.
Its great to see a chat, I have a quick question, I am looking for a fetchXML to sql class to include in my web app, do anyone built a class/library for that?
I downloaded the code from github and found the SQL Query Generator class which is helpful, but I am not able to generate FetchType
any input is appreciated :)
Jonas Rapp
@rappen

(Sorry about the delay, I'm currently at eXtreme365 in Dubrovnik)
The FetchType object is created from the FetchXML in this method: https://github.com/Innofactor/FetchXMLBuilder/blob/master/FetchXmlBuilder/DockControls/TreeBuilderControl.cs#L202-L212
The FetchType class is generated from the fetch.xsd schema file provided by Microsoft: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/org-service/fetchxml-schema
I use this cmd file to generate the class from the schema: https://github.com/Innofactor/FetchXMLBuilder/blob/master/FetchXmlBuilder/Resources/XSD%20fetch.cs.cmd

Hope this helps!

And feel free to send a pull request my way if you find improvements to the SQL conversion! It is still a bit beta...
Jonas Rapp
@rappen
Ping @mittapallikiran :)
Clint Woods
@clintolin
Is there a page showing examples of "not in" FetchXML?
Clint Woods
@clintolin
well more complicated than not in. Where a child table contains some records with this value and no records with so me other value
The query can be enhanced to do more complex filtering, let me know scenario and I might be able to assist!
Clint Woods
@clintolin
Thanks @rappen. Contacts (students) have Leads (students at a school) which have Enrollments (custom entity). I am looking for Students who enrolled last semester, but have not registered next semester.

In this fetch, the UI complains that "entityname" is invalid in the condition which I believe I see in the example given. Haven't gotten much past that. I see that my filters may need work, but this syntax issues has me stumped

<fetch mapping="logical" version="1.0" distinct="true" output-format="xml-platform" >
<entity name="contact" >
<attribute name="fullname" />
<attribute name="xyz_studentid" />
<attribute name="contactid" />
<filter type="and" >
<condition value="0" attribute="statecode" operator="eq" />
<condition value="1" attribute="xyz_isstudent" operator="eq" />
</filter>
<link-entity name="xyz_enrollment" to="contactid" from="xyz_student" alias="Fut" link-type="outer" />
<link-entity name="xyz_enrollment" to="contactid" from="xyz_student" alias="Prev" >
<filter type="or" >
<filter type="and" >
<condition entityname="Prev" attribute="xyz_code" operator="in" >
<value>{E165DCFC-785B-E711-8119-E0071B669EB1}</value>
<value>{E065DCFC-785B-E711-8119-E0071B669EB1}</value>
</condition>
<condition entityname="Prev" value="802430000" attribute="xyz_enrollmentstatus" operator="eq" />
</filter>
<filter type="and" >
<condition entityname="Fit" attribute="xyz_code" operator="in" >
<value>{EA65DCFC-785B-E711-8119-E0071B669EB1}</value>
<value>{E865DCFC-785B-E711-8119-E0071B669EB1}</value>
<value>{E665DCFC-785B-E711-8119-E0071B669EB1}</value>
<value>{E365DCFC-785B-E711-8119-E0071B669EB1}</value>
</condition>
<condition entityname="Fut" value="802430000" attribute="xyz_enrollmentstatus" operator="eq" />
</filter>
</filter>
</link-entity>
</entity>
</fetch>

entityname should be "Prev" and "Fut" ("FIt" was a typo)
image.png
Jonas Rapp
@rappen
The entityname attribute is not supported on condition elements under linked entities. You can only use them on conditions in filters on the base entity in the query. That is why this is not possible using the designer in FetchXML Builder.
Pushkaraj garge
@Pushkaraj_garge_twitter
Hi Guys,
can i use Left or Substring function to retrieve left 100 characters of any column?
Jonas Rapp
@rappen
Hi @Pushkaraj_garge_twitter , you can't do it in the query, it has to be done in the code processing the results unfortunately.
Daryl LaBar
@daryllabar
Just export to excel and do it there
Chris Nockolds
@flexsolvetech_twitter
Now call me a dumbbum, but I can't find this plugin in XRMToolBox. What might I be doing wrong?
Chris Nockolds
@flexsolvetech_twitter
Upgrade to the latest version of xrmtoolbox - easy really.
Daryl LaBar
@daryllabar
no problem dumbbum ;) #BeenThereDoneThat
'#Spelled"There"CorrectlyForJonas'sSake...
Jonas Rapp
@rappen
:D
Shannon Holck
@SMHolck
New to Dynamics, but want to test out FetchXMLBuilder ... XrmToolBox says incompatible with this version (1.2017.7.18) ... any ideas what I need to do? First time using XrmToolBox too. Sorry, such a nube!
MscrmTools
@MscrmTools
Download latest version of XrmToolBox first at https://www.xrmtoolbox.com
Shannon Holck
@SMHolck
Thanks, @MscrmTools ! I think it is working now. yay!
MscrmTools
@MscrmTools
You’re welcome! And... welcome to the magnificent world of XrmToolBox 😁 I hope (well, I’m sure!) it will help you a lot in your work with D365
Shannon Holck
@SMHolck
Is it possible to open more than one FetchXML file at a time?
Daryl LaBar
@daryllabar
@SMHolck you can have multiple instances of the plugin open.
Yatin Babaria
@ya_tin_twitter
What should be the value in "Paging Cookie" to enable paging when number of records are more than 5K
Jonas Rapp
@rappen
You can see the paging cookie when you use the Raw fetch result option. Then you can copy this from the results to your query for next page.
image.png
You can also use this option to always get all pages.
Yatin Babaria
@ya_tin_twitter
Thanks Jonas.. :)