The views and opinions expressed in this blog are those solely of the author(s) and do not necessarily reflect Microsoft’s current policy, position, or branding. For official announcements and guidance on Dynamics 365 apps and services, please visit the Microsoft Dynamics 365 Blog.
See the Problem Solver of the Month for DecemberCongratulations to Ievgen Miroshnikov for be selected in a random drawing on Jan. 2 for in our monthly Dynamics 365 Community Problem Solver Sweepstakes.
Read aboug Ievgen | Learn how to enter
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 Timeline
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
Microsoft Dynamics 365 Customer Engagement and Common Data Service offer us the querying language FetchXML to retrieve data. Since this is the language used for views saved in the system, we can use FetchXML Builder for XrmToolBox to alter the features of views beyond what is possible using platform features, without making them unsupported.
That should indeed be possible, I thought to myself, and started playing with the tool…
At the time of writing, it is unclear whether this approach is technically supported or not by Microsoft. I have found no information indicating it shouldn’t be, but will try to verify this.
Edit: I have now received confirmation from Microsoft thatthis approach is not unsupported!
First I opened system view Active Contacts in FetchXML Builder.
Then add a link-entity to the User entity.
To make it easier for myself with the syntax I used the owninguser lookup for this relationship.
Now I add a filter to the linked User entity to only include the current user.
This query has no magic, and will only show contacts where current user is the owner of the contact record. But our task was not to use the owner lookup, but to show contacts with an address in the same state as the current user’s state.
Since we want to change the join critera for the link-entity we will need to manually change the join attributes to the state on the contact and the user entities.
The resulting FetchXML looks like this:
<fetch version='1.0' output-format='xml-platform' mapping='logical' >
<entity name='contact' >
<attribute name='fullname' />
<order attribute='fullname' descending='false' />
<attribute name='parentcustomerid' />
<filter type='and' >
<condition attribute='statecode' operator='eq' value='0' />
<attribute name='telephone1' />
<attribute name='emailaddress1' />
<attribute name='contactid' />
<link-entity name='systemuser' from='address1_stateorprovince' to='address1_stateorprovince' >
<condition attribute='systemuserid' operator='eq-userid' />
To try the view in my Dynamics 365 organization, I save the view as a new personal view (I don’t want to overwrite the system view Active Contacts at this point).
Testing the view, and I now see all contacts in Stockholm, where I live!
Note that since the platform doesn’t really know how to render joins that are not based on anything other than physical relationships, it will look a bit strange opening this view in Advanced Find.
Note two that even though Advanced Find didn’t render the query properly, it was still possible for me to change the columns returned for the view, so I could include the State/Provice field.
The post Create view: Active Contacts in My State appeared first on The Dynamics 365 Trenches.
Business Applications communities