Search Archives - Aric Levin's Digital Transformation Blog http://aric.isite.dev/tag/search/ Microsoft Dynamics 365, Power Platform and Azure Thu, 12 May 2022 03:45:29 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 Multiple Fetch Xml Statements with Or Filter in Portal Web Template http://aric.isite.dev/dynamics/post/multiple-fetch-xml-or-filter-portal/ Wed, 16 May 2018 06:22:00 +0000 https://aric.isite.dev/index.php/2018/05/16/multiple-fetch-xml-statements-with-or-filter-in-portal-web-template/ In a recent project, we had a requirement to display cases to the portal that are associated with either Contacts or Accounts. Our case entity had a related entity called Case Contacts, and our account entity had a related entity called Account Contacts. The account entity had a list of all the cases associated with the account.

The post Multiple Fetch Xml Statements with Or Filter in Portal Web Template appeared first on Aric Levin's Digital Transformation Blog.

]]>
In a recent project, we had a requirement to display cases to the portal that are associated with either Contacts or Accounts. Our case entity had a related entity called Case Contacts, and our account entity had a related entity called Account Contacts. The account entity had a list of all the cases associated with the account.

The issue that we had was that we could retrieve each list of cases individually, but the result could be duplicate where a case could be associated with both a Case Contact and an Account Contact.

We were struggling on whether to retrieve the first fetch, and then the second fetch and check the values that were part of the second fetch didn’t appear in the list of first fetches, or the alternative was to have a single fetch Xml that contained both conditions with an Or Condition in-between. The issue here is that advanced find does not allow created an Or condition with related entities.

Thanks to a post by Alex Shlega, we were able to do this easily. This can be done using XRMToolbox Fetch Xml Builder or just writing the Fetch Directly in a Text editing tool. The end result that we had was the following:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
  <entity name="incident" >
    <attribute name="incidentid" />
    <attribute name="title" />
    <attribute name="customerid" />
    <attribute name="xrm_businessname" />
    <attribute name="statecode" />
    <attribute name="statuscode" />
    <filter type="or" >
      <condition entityname="ad" attribute="xrm_contactid" operator="eq" value="{{user.id}}" />
      <condition entityname="ab" attribute="xrm_contactid" operator="eq" value="{{user.id}}" />
    </filter>
    <link-entity name="account" from="accountid" to="customerid" link-type="outer" alias="ac" >
      <link-entity name="xrm_accountcontact" from="xrm_accountid" to="accountid" link-type="outer" alias="ad" >
      </link-entity>
    </link-entity>
    <link-entity name="xrm_casecontact" from="xrm_caseid" to="incidentid" link-type="outer" alias="ab" />
  </entity>
</fetch>

By adding the entity names to the Or Filter, we are able to specify conditions for the linked entities, and by doing this filter multiple linked entities with an Or Condition.

This resolves the issue of having to deal with duplicates in the results or having multiple result sets from separate Xml statements.

The post Multiple Fetch Xml Statements with Or Filter in Portal Web Template appeared first on Aric Levin's Digital Transformation Blog.

]]>
Viewing Quote Closure Information in your views http://aric.isite.dev/dynamics/post/view-quote-closure-in-views/ Wed, 06 Sep 2017 18:02:00 +0000 https://aric.isite.dev/index.php/2017/09/06/viewing-quote-closure-information-in-your-views/ We recently had a requirement to enable us to see the Date Won field of the Quote entity which appears when an Order is created (Quote is closed as Won), and although that field can be seen when the Order is created, the field was not located.

The post Viewing Quote Closure Information in your views appeared first on Aric Levin's Digital Transformation Blog.

]]>
We recently had a requirement to enable us to see the Date Won field of the Quote entity which appears when an Order is created (Quote is closed as Won), and although that field can be seen when the Order is created, the field was not located.

In researching this further, we found out that the best way to get that information, is by getting the values from the Quote Close activity entity (quoteclose). The Quote Close entity is basically an Activity entity, so it has the Actual Start Date and Actual End Date fields. The Actual End Date field that is displayed to us is basically the Quote won field.

In order to display the information of the Quote including closure information in a view, we would need to query the Activity Entity, and add a Join to the Regarding (Quote) relationship. Thie would allow us to query the Quote Closure information (as seen in the screenshot below).

Activities Advanced Find

If we need to see the columns from the Quote Closure entity as well, we can Add Columns, and change the record type from Activity to Regarding (Quote):

Activities Add Quote Close Columns

The post Viewing Quote Closure Information in your views appeared first on Aric Levin's Digital Transformation Blog.

]]>
Retrieving All Records owned by other Team Members http://aric.isite.dev/dynamics/post/retrieve-all-records-owned-by-other-team-members/ Fri, 06 Nov 2015 04:59:00 +0000 https://aric.isite.dev/index.php/2015/11/06/retrieving-all-records-owned-by-other-team-members/ We recently got into a situation where a client wanted to have a view that will display all the records of all the users that belong to the same team as the logged in user. Originally we thought it would be easy, but it happens to be slightly more complex.

The post Retrieving All Records owned by other Team Members appeared first on Aric Levin's Digital Transformation Blog.

]]>
We recently got into a situation where a client wanted to have a view that will display all the records of all the users that belong to the same team as the logged in user. Originally we thought it would be easy, but it happens to be slightly more complex.

The first thought of course is to modify the “My Active Comments” view to include both Owner Equals Current User and Owner Equals Current User’s Teams, but that of course will only retrieve the records that are owned by the logged in user or the actual team, not the team members.

The next option was of course creating a view with various levels of linked entities and set the IsDefault of the team entity to No, so that not all team members will be retrieved.
Since this was a comments system and the application had a lot of teams for different Roles and Categories, so setting the IsDefault attribute to No would not solve our problem because we would still get the Role based users.

What we ended up doing is excluding from the view all of the Teams that are “Role based”, which included Users spanning across different categories. by doing so, we were able to retrieve the expected results.

Team Members View

When looking at the view, we will be able to see all the records that are assigned to other members of your team.

The post Retrieving All Records owned by other Team Members appeared first on Aric Levin's Digital Transformation Blog.

]]>