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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Calculate Account Activites

(0) ShareShare
ReportReport
Posted on by

Hi, 

I wanted to ask, how to calculate all activities Regarding account? I Need a field to see, which account have the most activities and which have less than expected or none. Maybe anyone have suggestions? 

Thank you. 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Karsten Wirl Profile Picture
    4,477 on at
    RE: Calculate Account Activites

    Hello.

    You can do it by using rollup fields...

    community.dynamics.com/.../193741

    But be aware that you will face some limitations.

    Plug-ins are also a good solution.

    Kind regards,

    Karsten

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Calculate Account Activites

    1.

    You could do this via the web api with something like this has certain limitations though as it would only get called when a user opens up an account record.

    var req = new XMLHttpRequest();
    req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/activitypointers?$filter=_regardingobjectid_value eq your_account_guid&$count=true", true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
    req.onreadystatechange = function() {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 200) {
                var results = JSON.parse(this.response);
                var recordCount = results["@odata.count"];
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send();

    2.

    Create a plugin that runs on create for all activities, check the regardingobject field and update the counter on the account form if valid.

    Hope this can help you

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans