For example, I have a Case and some activities, which are related. How can I get the information from this activities, when case form is onload?
*This post is locked for comments
Hi Lyubo,
great!
Could you please mark the answers as verified? Thanks a lot!
Regards,
Karan
I did it because of your answers. I am really thankful to all of you.
Use CRMRestBuilder tool to get activities on case:
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/activitypointers?$select=actualend,actualstart,_regardingobjectid_value,scheduledend,scheduledstart,senton,statecode,statuscode&$filter=_regardingobjectid_value eq'" +Xrm.Page.data.entity.getId()+"'", 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);
for (var i = 0; i < results.value.length; i++) {
var actualend = results.value[i]["actualend"];
var actualstart = results.value[i]["actualstart"];
var _regardingobjectid_value = results.value[i]["_regardingobjectid_value"];
var _regardingobjectid_value_formatted = results.value[i]["_regardingobjectid_value@OData.Community.Display.V1.FormattedValue"];
var _regardingobjectid_value_lookuplogicalname = results.value[i]["_regardingobjectid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
var scheduledend = results.value[i]["scheduledend"];
var scheduledstart = results.value[i]["scheduledstart"];
var senton = results.value[i]["senton"];
var statecode = results.value[i]["statecode"];
var statecode_formatted = results.value[i]["statecode@OData.Community.Display.V1.FormattedValue"];
var statuscode = results.value[i]["statuscode"];
}
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
It will be also helpful if you can give me some more detail on that what you want to do.
Do you need to aggregate the records? Some status of the records? Waht exactly is the target?
André Arnaud de Cal...
292,162
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156