Following code can be used to retrieve collection of ‘rolled up’ activities for couple of standard entities (account, contact and opportunity). You can find detailed description here.
var target = { "@odata.id": "accounts(F591DEE6-5B2F-E711-8110-C4346BAC5238)" }; var query = { "@odata.type": "Microsoft.Dynamics.CRM.QueryExpression", "EntityName": "activitypointer", "ColumnSet": {"AllColumns":"true"} }; var requestUrl = "/api/data/v8.2/Rollup(Target=@p1,RollupType=@p2,Query=@p3)"; requestUrl += "?@p1=" + JSON.stringify(target); requestUrl += "&@p2=Microsoft.Dynamics.CRM.RollupType'Extended'"; requestUrl += "&@p3=" + JSON.stringify(query); var context; if (typeof GetGlobalContext === "function") { context = GetGlobalContext(); } else { context = Xrm.Page.context; } var req = new XMLHttpRequest(); req.open("GET", context.getClientUrl() + requestUrl, 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.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var results = JSON.parse(this.response); //you've got results to results variable } else { var errorText = this.responseText; //handle error here } } }; req.send();