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

  • SEARCH
  • Home
  • 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 7020427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:19:02+00:00 2026-05-27T23:19:02+00:00

I am using an IFD CRM2011 environment and I am following this MSDN example

  • 0

I am using an IFD CRM2011 environment and I am following this MSDN example to query the ODATA endpoint to populate a dropdown menu within an IFrame.

Here is the code that populates the drop down list:

function GetQuestionSetList() {
    var query = '/Mhc_questionsetverSet?' +
      '$select=Mhc_name,Mhc_questionsetverId&$filter=statecode/Value eq 0';
    SDK.RestEndpointPaging
       .RetrieveRecords(query, ProcessReturnedQuestionSetVersions);
}

function ProcessReturnedQuestionSetVersions(retrievedQuestionSets) {
    for (var i = 0; i < retrievedQuestionSets.length; i++) {
        var questionSet = retrievedQuestionSets[i];
        var value = questionSet.Mhc_questionsetverId;
        var name = questionSet.Mhc_name;

        //add option to select list
        $('#selectQuestionSetVersion').append($('<option>')
                                      .attr('value', value)
                                      .text(name));
    }
}

After the SDK.RestEndpointPaging.RetrieveRecords(query, ProcessReturnedQuestionSetVersions); line executes I am prompted with this dialog:

enter image description here

At this point I can either enter my credentials or press cancel and the dropdown is populated. In the developer tools I notice this error in both cases:

SCRIPT5022: Exception thrown and not caught

mhc_json2.js, line 484 character 13

// If the text is not JSON parseable, then a SyntaxError is thrown.

            throw new SyntaxError('JSON.parse');  //line 484
        };
    }
}());

I can’t figure out why this dialog is appearing or why this error is being thrown.

  • 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-05-27T23:19:03+00:00Added an answer on May 27, 2026 at 11:19 pm

    After posting this, I just happened to check fiddler and discovered the problem. There are two calls to RetrieveRecords in my situation. The first call returns status 200 (success) but the second returns 401.

    Here are the two calls:

    https://alpha.ftg.com:5556//xrmservices/2011/organizationdata.svc/Mhc_questionsetverSet?$select=Mhc_name,Mhc_questionsetverId&$filter=statecode/Value eq 0

    https://alpha.ftg.com:5556//xrmservices/2011/organizationdata.svchttps://alpha.ftg.com:5556/xrmservices/2011/organizationdata.svc/Mhc_questionsetverSet?$filter=statecode/Value%20eq%200&$select=Mhc_name,Mhc_questionsetverId&$skiptoken=1,’mhc_questionsetverid’,’%7B3F737386-54DF-DE11-A55C-00155D020C0D%7D’,’%7B7AF1B564-C3BF-DD11-8209-000BCDC54FC9%7D’

    In the second call the server + odata endpoint are concatenated twice. The RetrieveRecordsCallback function is supposed to strip the server and endpoint url if the __next parameter is found as seen here:

    MSDN explanation:

    If a __next property is found the new URL with a $skiptoken is passed back to SDK.RestEndpointPaging.RetrieveRecords as the new filter parameter value so that the process is repeated for each set of records until the total >number of requested records is retrieved and the __next property is no longer returned.

    if (null != retrievedRecords.__next) {
        // The existance of the '__next' property 
        //indicates that more records are available
        // So the originating function is called again 
        //using the filter value returned
        var filter = retrievedRecords.__next
            .replace(SDK.RestEndpointPaging.GetODataPath(), "");
       SDK.RestEndpointPaging.RetrieveRecords(filter, callback);
    }
    

    The SDK.RestEndpointPaging.GetODataPath() is appending an extra / between the server and endpoint parts of the url, but when the new filter parameter is returned that extra / has been stripped so the .replace function fails to replace the path and it gets appended a second time.

    The fix was trivial. Just change the SDK.RestEndpointPaging.GetODataPath() function to this:

     GetODataPath: function () {
            /// <summary>
            /// Utility function to retrieve the path to the REST endpoint.
            /// </summary>
            var serverUrl = Xrm.Page.context.getServerUrl();
    
            //remove the extra '/' char if it exists
            if (serverUrl.match(/\/$/)) {
                serverUrl = serverUrl.substring(0, serverUrl.length - 1);
            }
    
            return serverUrl + "/xrmservices/2011/organizationdata.svc";
        },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following jQuery Color plugin: /* Color animation jQuery-plugin http://www.bitstorm.org/jquery/color-animation/ Copyright
I am using the following code to rendered the facebook login button <div id=facebook-login>
I am using fb connect using js. This is my code: <script> window.fbAsyncInit =
I'm using this code to process my folders and files with two subs: sub
I am loading images in background . using this code -(void)backgroundImageLoading { if(isGroupOrFriend) {
I'm using PIL. im = im.rotate(angle=-90, expand = True) When I do this, it
This is the code I am using # update db client = Mysql2::Client.new(:host =>
I am trying using the following code in my spec file, I am installing
I am using this to extract SPAN tags and tell how many there is.
I tried doing selecting multiple rows using jquery but this code look like cranky.

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.