Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

SDK Retrieve Multiple

(0) ShareShare
ReportReport
Posted on by 250

Hello everyone, my name is Taniguchi and i have this code to retrieve multiple information for a entity and populate in another but i am having some trouble to understand it:

SDK.REST.retrieveRecord(crd4c_UF.Id, "crd4c_uf", "crd4c_RegioEconmica,crd4c_RegioGeogrfica", null, function(result) {
                    var crd4c_RegioEconmica = result.crd4c_RegioEconmica.Value;
                    var crd4c_RegioGeogrfica = result.crd4c_RegioGeogrfica.Value;
                           
                    Xrm.Page.getAttribute("crd4c_regioeconmicaa").setValue(crd4c_RegioEconmica);
                    Xrm.Page.getAttribute("crd4c_regiogeogrfica").setValue(crd4c_RegioGeogrfica);
   
                    Xrm.Page.getControl("crd4c_regiogeogrfica").setVisible(true);
                    Xrm.Page.getControl("crd4c_regioeconmicaa").setVisible(true);
                }, function(error) {
                    Xrm.Utility.alertDialog(error.message);
                });

function(result), what this function do exactly ?

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: SDK Retrieve Multiple

    Hi,

    See here how to use  CRMRestBuilder to generate Javascript API code.

    www.youtube.com/watch

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: SDK Retrieve Multiple

    That's retieving the value from the result returned by the rest api and storing it in a variable.

  • TaniSantos Profile Picture
    TaniSantos 250 on at
    RE: SDK Retrieve Multiple

    I understand now, for the last question i didnt understand this line of code.

    var crd4c_RegioEconmica = result.crd4c_RegioEconmica.Value;

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: SDK Retrieve Multiple

    Please refer my answer here in old thread-

    community.dynamics.com/.../277470

  • TaniSantos Profile Picture
    TaniSantos 250 on at
    RE: SDK Retrieve Multiple

    Thannks everyone for the answer, one thig i didnt understand, im using crm online and this code worked just fine, but why microsoft is saying that the xrm.page is deprecated, if the code is working in the field i put it ?

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: SDK Retrieve Multiple

    Hi,

    This (SDK.REST) is the helper JavaScript library which was used to perform the CRUD operation using REST API in earlier versions of CRM. The method SDK.REST.retrieveRecord is used to retrive a single record which accepts the following parameter:  id, type, select, expand, successCallback, errorCallback which means in the shared example,  you are trying to retrieve the field ["crd4c_RegioEconmica,crd4c_RegioGeogrfica"] from the entity ["crd4c_uf"] by passing the entity guid as [crd4c_UF.Id].

    You can find the detailed description of this method from the below link:

    docs.microsoft.com/.../gg334427(v=crm.7)

    As suggested above, if you are looking to implement this then you should use the updated/ compatible version i.e. using WEB API. I would suggest to use CRM Rest Builder to build the WEB API request. This is the easiest way to build the query as well as execute it and see the results.

    carldesouza.com/dynamics-crm-rest-builder

    You can download the tool here- github.com/.../releases

    Hope this helps.

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: SDK Retrieve Multiple

    Hi Taniguchi,

    Hope you are doing well , before answering your question may I know which version of CRM you are using?

    I am asking as because SDK.REST was used  before introduce of WEB API  or you can say to use in dynamics CRM 2015. Below reference will helps you to understand more -

    docs.microsoft.com/.../gg334427(v=crm.7)

    In addition to that  I would suggest if you are using Dynamics CRM 2016 or above version 8.0  , use WEB API  as above method might  be deprecated in the coming release.

    You can have a look my answer in below thread -

    community.dynamics.com/.../281953

  • BadrinathB Profile Picture
    BadrinathB 970 on at
    RE: SDK Retrieve Multiple

    www.youtube.com/watch

  • Suggested answer
    BadrinathB Profile Picture
    BadrinathB 970 on at
    RE: SDK Retrieve Multiple

    Hi,

    function(result) actually holds the output/data in object form (result) based on the query which you have put inside your retrieve function (SDK.REST.retrieveRecord). This is more or less like writing an inline function in javascript. The same can be achieved by a explicit function as explained in the below link. function(result) and function(error) are called inline functions. (OOPS concept in JS :) or TS)

    arunpotti.wordpress.com/.../restretrieveexample

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,401 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans