Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Problem with SDK.REST.retrieveRecord for Mobile Client

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

SDK.REST.retrieveRecord is not working with Mobile Client.

It is working fine with IE and Chrome in Laptop.

It throws an error as shown in below screenshot:


function CopyList(selectedItemsSelectedIndex) {
var accountId = selectedItemsSelectedIndex.length > 0 ? selectedItemsSelectedIndex[0].toString() : null;
var marketinglist, approval;
for (var i = 0; i < selectedItemsSelectedIndex.length; i++) {
SDK.REST.retrieveRecord(selectedItemsSelectedIndex[i].toString(), "kpmg_marketlistmemberapprov", "kpmg_AList,kpmg_Status", null,
function (result) {
if (result) {
marketinglist = result.kpmg_AList;
approval = result.kpmg_Status;
}
}, SDK.REST.errorCallback, function () { console.log("Retrieve Single record call completed"); }, false);
}

786315.Capture.PNG

I am using Dynamics 365 online.

Thank You .

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Problem with SDK.REST.retrieveRecord for Mobile Client

    Hi Vijaya,

    Could you please use new dynamics 365  WEB API  instead of SDK.REST call as dynamics CRM will deprecated gradually SDK.Rest calling mechanism. Here is the sample code.

    var contactId = Xrm.Page.data.entity.getId();

    var req = new XMLHttpRequest();

    req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.1/contacts("+contactId +")?$select=accountrolecode,fullname,gendercode", true);

    req.setRequestHeader("OData-MaxVersion", "4.0");

    req.setRequestHeader("OData-Version", "4.0");

    req.setRequestHeader("Accept", "application/json");

    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

    req.onreadystatechange = function() {

       if (this.readyState === 4) {

           req.onreadystatechange = null;

           if (this.status === 200) {

               var result = JSON.parse(this.response);

               var accountrolecode = result["accountrolecode"];

               var fullname = result["fullname"];

               var gendercode = result["gendercode"];

           }

           else {

               alert(this.statusText);

           }

       }

    };

    req.send();

    Thanks

    Goutam

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans