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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Count Phone Calls in case record for account

(0) ShareShare
ReportReport
Posted on by

Hi experts,

I would like like to display the number of phone calls that have been logged in the past 90 days in active case records for each account in some custom field.

Now, one account can have multiple cases. 

So how can I add the number of phone calls and display them in the account record?

Thanks,

Jon

*This post is locked for comments

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    You could do a rollup on case entity to give you a count of phone call but then you can't rollup that to account. So you would need to write a plugin which will trigger on create of phone call which would do the following-

    1) Check if the entity is phonecall)

    2) Check if it is regarding a case

    3) Get the case reference from that phone call and then retrieve the case details

    3) From the case details, get the account

    4) Once you get the account, run a query to find all the phone call for all the cases for that account, You can use the below fetch to get the count, you need to dynamicaly pass the account id

    ==============

    <fetch mapping='logical' version='1.0' output-format='xml-platform' distinct='false' aggregate='true' >

       <entity name='phonecall' >

           <attribute name='activityid' alias='count' aggregate='count' />

           <link-entity name='incident' to='regardingobjectid' from='incidentid' alias='ab' link-type='inner' >

               <filter type='and' >

                   <condition value='{DA608716-EB3E-E811-A953-000D3AD1CE3A}' attribute='customerid' uitype='account' operator='eq' />

               </filter>

           </link-entity>

       </entity>

    </fetch>==========

    Below is the sample code snippet to execute fetchxml

    ==========

    string fetchXml = @"<fetch mapping='logical'>

                                      <entity name='organization'>

                                         <all-attributes />                                        

                                      </entity>

                                   </fetch>";

                   var entityCollection = service.RetrieveMultiple(new FetchExpression(fetchXml));

    ==========

    5. Once you get the count, you can update the field in account entity.

    Hope this helps.

  • Community Member Profile Picture
    on at

    Hi Ravi,

    Thanks for your reply.

    I'll try to do the same.

    Thanks,

    Jon

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans