web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Create view based on linked entity used twice

(0) ShareShare
ReportReport
Posted on by 71

Hello,

I want to create view which retrieves all activities which are assigned to two Salespeople, which have their two separate fields (lookup) on Account entity:

6457.pastedimage1592582929513v1.png

I'm able only to retrieve activites assigned to one of the representatives:

8715.pastedimage1592583343479v2.png

Here I'm going from 1:N relationship between Activity and User, and then, 1:N relationship between User and Account. This view correctly shows all activities assigned to all people that are Representative 1.

But pulling in the second field, it seems that it takes the inner result of all the clauses (so Activities for Users that are BOTH Representative 1 and 2, which is not a common case:

0172.pastedimage1592585085258v3.png

Here's the XML of the second query:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
  <entity name="activitypointer" >
    <attribute name="subject" />
    <attribute name="activitytypecode" />
    <order attribute="subject" descending="false" />
    <link-entity name="systemuser" from="systemuserid" to="owninguser" alias="aa" >
      <link-entity name="account" from="pr_representative1" to="systemuserid" alias="ab" />
      <link-entity name="account" from="pr_representative2" to="systemuserid" alias="ac" />
    </link-entity>
    <attribute name="ownerid" />
    <attribute name="createdon" />
    <attribute name="activityid" />
  </entity>
</fetch>

I'm not sure what I'm missing here... Is even this scenario achievable using FetchXML? Or do I need to lean towards the plugin or script? Or maybe something different?

My goal is to create a chart counting all of the activities for the both types of representative- maybe there's someting that can be done directly in chart structure?

I have the same question (0)
  • Suggested answer
    LuHao Profile Picture
    40,892 on at

    Hi Pocia,

    Group OR cannot be used between entities, only between fields, so we have to create two custom fields and use them to represent the results of the two entities.

    New two Whole Number fields on the User entity, set them as Rollup fileds

    pastedimage1592991742195v1.png        pastedimage1592991894424v4.png

    pastedimage1592991873251v3.png        pastedimage1592991832466v2.png

    When these two Rollup fields are created, they will wait for 12 hours and then automatically calculate the latest results every hour.

    Then in the Advanced Settings, set the filter as follow, use Group OR to connect both Rollup fields.

    pastedimage1592992165508v5.png

    The Rollup field is summarized once every hour, so when you query, the result may not be the latest. We can use Flow to replace the function of Rollup.

    Flow can update the latest summary results in real time

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans