Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

SDK.REST retrieverecord keeps returning no results when data exist

Posted on by 1,530

I can't figure out why the SDK.REST.RetrieveRecord is not returning results when the data does exist.

On my form properties I have all the necessary SDK  library's that are needed.  The code is also not falling into the errorhandler.

Any ideal on what I am doing wrong?

FormPage.JPG

When debugging the retrieverecord is returning me results is not defined.

SDK.REST.JPG

Error message

0407.ErrorMessage.JPG

*This post is locked for comments

  • Verified answer
    rthompson Profile Picture
    rthompson 1,530 on at
    RE: SDK.REST retrieverecord keeps returning no results when data exist

    Hi Abby,

    I found my problem.  The the GUID {F2D2679F-9C1A-E811-80DA-005056BA7CE0} was returning {}.

    The method is now working correctly once I removed the {}.

    function getselectorclauseprofile(selectortemplateid) {

        var entityName = "new_selectortemplate";
    
        SDK.REST.retrieveRecord(

           selectortemplateid.replace(/{/g,'').replace(/}/g,''),
           'new_selectortemplate',        'new_name,new_ClauseNumberId',        null,        function (results) {            var itype = 'none' //results.new_ClauseNumberId.Id;            Xrm.Page.getAttribute("new_ClauseNumberId").setValue(itype);        },        errorHandler     ); }
  • Verified answer
    Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: SDK.REST retrieverecord keeps returning no results when data exist

    Hello rthompson,

    From the image, results' variable scope is only inside function(results){...} and the break-point is on the last line outside the scope.

    Can you please break(debug) inside function(results){} to the check value of results?

    You can put a line debugger; inside function(results){} to make sure it breaks inside the scope and check the value with console.

    Regards,

    Abby

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: SDK.REST retrieverecord keeps returning no results when data exist

    Hi rthompson,

    To solve this problem you need to declare results, or you need make sure it is available in your current script or scope.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans