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)

Error prompt

(0) ShareShare
ReportReport
Posted on by 222

Hi All,

We have a javascript code on our account form. When we open the account form for the first time it is giving error prompt. Importantly we are not getting these prompts always. These prompts are coming very randomly. We cant figure out what the issue could be.

4478.11.PNG

Below is the part of code responsible for the prompt:

var ODATA_Final_url = serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection + ODATA_Query; //crm4org5578a.crm4.dynamics.com/.../SystemUserSet(guid'AF0048BE-4430-E011-88A9-1CC1DE6DEBD9')

//Calls the REST endpoint to retrieve data
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: ODATA_Final_url,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function (data, textStatus, XmlHttpRequest) {
checkParentBU(data.d.BusinessUnitId.Id);
},
error: function (XmlHttpRequest, textStatus, errorThrown) {
alert('Error:(function onLoad) ' + ODATA_Final_url + errorThrown + textStatus);

}
});
}

Thanks 

Aparna

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Error prompt

    Seems this is security related issue make sure login user having sufficient privileges to read the User entity. In addition also check the user business unit.

  • Aparna1 Profile Picture
    222 on at
    RE: Error prompt

    Yes Goutam. It seems you are correct. But why the same user sometime gets the error and sometimes not. Due to this we are not able to check anything certainly.

    Thanks

    Aparna

  • gdas Profile Picture
    50,091 Moderator on at
    RE: Error prompt

    What is this function does , probably something wrong here , could you please share your complete code -

    checkParentBU(data.d.BusinessUnitId.Id);

  • Aparna1 Profile Picture
    222 on at
    RE: Error prompt

    //Get GUID of logged user

       var user = Xrm.Page.context.getUserId();

       var userId = user.substring(1,37);

       // Read the CRM Context to determine the CRM URL

       var serverUrl = Xrm.Page.context.getClientUrl()

       var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";

       var ODATA_EntityCollection = "/SystemUserSet";

       // Specify the ODATA Query

       var ODATA_Query = "(guid\'" + userId + "')";

       // Combine into the final URL

       var ODATA_Final_url = serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection + ODATA_Query; //crm4org5578a.crm4.dynamics.com/.../SystemUserSet(guid'AF0048BE-4430-E011-88A9-1CC1DE6DEBD9')

       //Calls the REST endpoint to retrieve data

       $.ajax({

           type: "GET",

           contentType: "application/json; charset=utf-8",

           datatype: "json",

           url: ODATA_Final_url,

           beforeSend: function (XMLHttpRequest) {

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

           },

           success: function (data, textStatus, XmlHttpRequest) {

               checkParentBU(data.d.BusinessUnitId.Id);

           },

           error: function (XmlHttpRequest, textStatus, errorThrown) {

               alert('Error:(function onLoad) ' + ODATA_Final_url + errorThrown + textStatus);

           }

       });

    }

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
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans