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)

Problems with "retrieveRecord"

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I have a problem when I try to get a record using the next sentence:

SDK.REST.retrieveRecord(subscriberId,"Account", null, null, foundsubscriber, functionError);

This is executed in the onload event of the form.

The problem is sometimes enters the function "foundsubscriber" and others do not with the same "subscriberId". This is a strange behavior of CRM 2016 and I can't found a reason.

Do you have any idea?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    JohnAnonymous Profile Picture
    5,241 on at
    RE: Problems with "retrieveRecord"

    Do you get any errors in the browser console when it's not working? Are you sure it's not a permission error?

  • Community Member Profile Picture
    on at
    RE: Problems with "retrieveRecord"

    Hi HMBA,

    could you please give us some more details on your issue. Is it possible to share your code?

    Regards,

    Karan

  • Community Member Profile Picture
    on at
    RE: Problems with "retrieveRecord"

    I have an error in console but I do not think it has anything to do with the problem:

    Error in console: "Refused to set unsafe header "Content-Length"

    But sometimes works well, this discard it a permission error.

  • Community Member Profile Picture
    on at
    RE: Problems with "retrieveRecord"

    Hi Karan5959,

    This is the code:

    function getSubscriber(subscriberId)

    {

      if(subscriberId == null)

      {

        var subscriberRef  = Xrm.Page.getAttribute("accountsubscriptionid").getValue();

        subscriberId = subscriberRef[0].id

      }

      function foundsubscriber(sus)

      {

           subscriber = sus;

           function CorporateSubscriber(susCorpo)

           {

               subscriberCorpo = susCorpo;

               Xrm.Page.ui.refreshRibbon();

           }

           if(subscriber.ParentAccountId != null && subscriber.ParentAccountId.Id != null)

              SDK.REST.retrieveRecord(subscriber.ParentAccountId.Id,"Account", null, null, CorporativoSubscriber, functionError);

           Xrm.Page.ui.refreshRibbon();

      }

      if(subscriberId != null)

         SDK.REST.retrieveRecord(subscriberId,"Account", null, null, foundsubscriber, functionError);

    }

    The problem is in the line: <<SDK.REST.retrieveRecord(subscriberId,"Account", null, null, foundsubscriber, functionError);>>

  • Verified answer
    JohnAnonymous Profile Picture
    5,241 on at
    RE: Problems with "retrieveRecord"

    And the functionError callback is not executed when it's not working?

    You could als add a debugger statement above the error line to check the values you are sending to the rest call.

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