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)

Retrieve 1:N relationships with javascript dynamics 365 crm

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Check this out:

    msdn.microsoft.com/.../gg334427(v=crm.7).aspx

    Regards,

    Karan

  • Verified answer
    Community Member Profile Picture
    on at

    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?

  • Verified answer
    Community Member Profile Picture
    on at

    Use CRMRestBuilder tool to get activities on case:

    github.com/.../releases

    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();

  • Verified answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi,

    See the link below.

    msdn.microsoft.com/.../gg334208.aspx

    Hope this helps.

  • Verified answer
    Community Member Profile Picture
    on at

    I did it because of your answers. I am really thankful to all of you.

  • Verified answer
    Community Member Profile Picture
    on at

    Hi Lyubo,

    great!

    Could you please mark the answers as verified? Thanks a lot!

    Regards,

    Karan

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
JS-09031509-0 Profile Picture

JS-09031509-0 3

#3
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans