web
You’re offline. This is a read only version of the page.
close
Skip to main content
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

I have the same question (0)
  • Suggested answer
    BadrinathB Profile Picture
    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

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

    www.youtube.com/watch

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator 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

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator 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.

  • TaniSantos Profile Picture
    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
    gdas Profile Picture
    50,091 Moderator on at
    RE: SDK Retrieve Multiple

    Please refer my answer here in old thread-

    community.dynamics.com/.../277470

  • TaniSantos Profile Picture
    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
    RaviKashyap Profile Picture
    55,410 Moderator 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.

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

    Hi,

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

    www.youtube.com/watch

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans