Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8646759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:53:45+00:00 2026-06-12T12:53:45+00:00

I’m currently learning CRM 2011 while working with it, and I thought this could

  • 0

I’m currently learning CRM 2011 while working with it, and I thought this could be a helpful example.
In a javascript function I need to retrieve all Subject entity records and cache them on the client.
I also need them to be cached within their heirarchy.
I would think the best way to do this is to return each subject record with its id and parent id, so I can build a client-side structure in javascript.

Does anyone with CRM experience have any suggestions as to how this query should be coded? I’m ok with processing the data, just no idea how to return the results I need!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:53:46+00:00Added an answer on June 12, 2026 at 12:53 pm

    Your answer probably works, but tbh there were too many clicks for me.

    This is how I did it in the end. cacheSubjects is the main function:

    var sgc_subjectCache = [];
    var sgc_subjectCacheCount = 0;
    
    function cacheSubjectsCallback(data) {
        // update subjects
        // loop through retrieved subjects and add to cache
        for( i=0; i < data.length; i++ )
        {
            var subject = data[i];
            subject.Root = subject.Title;
            // var subjectid = subject.SubjectId;
            sgc_subjectCache.push( subject );
            sgc_subjectCacheCount += 1;
        }
    }    
    
    function cacheSubjectsComplete() {
        // now update title with ancestors
        var done = false;
        while(done==false)
        {
            done = true;
            // outer loop
            var len = sgc_subjectCache.length;
            for( var i=0; i < len-1; i++ )
            {
                subject = sgc_subjectCache[ i ];
                // inner loop
                for( var j=0; j < len-1; j++ )
                {
                    subject2 = sgc_subjectCache[ j ];
                    if( subject.ParentSubject.Id === subject2.SubjectId )
                    {
                        // found the parent
                        var newTitle = subject2.Title + ' : ' + subject.Title;
                        sgc_subjectCache[ i ].Title = newTitle;
                        sgc_subjectCache[ i ].Root = subject2.Root;
                        sgc_subjectCache[ i ].ParentSubject.Id = subject2.ParentSubject.Id;
                        done = false; // more to do
                    }
                }
            }
        }
    
    }
    
    function cacheSubjects() {
        sgc_subjectCache = [];
        var options = "$select=Title,SubjectId,ParentSubject";
        SDK.REST.retrieveMultipleRecords("Subject", options, cacheSubjectsCallback, function(error) {
            alert( error );
        }, cacheSubjectsComplete);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I need a function that will clean a strings' special characters. I do NOT
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.