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: 404 - File or directory not found

(1) ShareShare
ReportReport
Posted on by 12,119 Moderator

Hi all

I am using following code:

function ClonePhoneCall() {
var serverUrl = Xrm.Page.context.getClientUrl();
if (RecordId != null) {
var RecordId = RecordId.replace('{', '').replace('}', '');

var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
var ODATA_EntityCollection = "/PhoneCallSet";
var QUERY = "(guid'" + RecordId + "')?"
QUERY += "$select=PhoneNumber,DirectionCode,RegardingObjectId,"
QUERY += "Subject,Description,ScheduledEnd,PriorityCode,OwnerId";
var URL = serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection + QUERY;

$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: URL,
beforeSend: function (XMLHttpRequest) {
//Specifying this header ensures that the results will be returned as JSON.
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function (data, textStatus, XmlHttpRequest) {
//This function will trigger asynchronously if the Retrieve was successful
Object = data.d;
},
error: function (XmlHttpRequest, textStatus, errorThrown) {
//This function will trigger asynchronously if the Retrieve returned an error
alert("AJAX call failed; Error - " + XmlHttpRequest.responseText);
}
});
}
}

and it is giving me this error:

AJAX call failed; Error - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "www.w3.org/.../xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

<title>404 - File or directory not found.</title>

<style type="text/css">

<!--

body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}

fieldset{padding:0 15px 10px 15px;}

h1{font-size:2.4em;margin:0;color:#FFF;}

h2{font-size:1.7em;margin:0;color:#CC0000;}

h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}

#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;

background-color:#555555;}

#content{margin:0 0 0 2%;position:relative;}

.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}

-->

</style>

</head>

<body>

<div id="header"><h1>Server Error</h1></div>

<div id="content">

<div class="content-container"><fieldset>

<h2>404 - File or directory not found.</h2>

<h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>

</fieldset></div>

</div>

</body>

</html>

I do not know Where an I wrong? Please suggest me the solution.

Thank You

*This post is locked for comments

I have the same question (0)
  • Verified answer
    jlattimer Profile Picture
    24,562 on at
    RE: Error: 404 - File or directory not found

    Trying changing this line:

    Object = data.d;

    To this:

    var result = data.d;


  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at
    RE: Error: 404 - File or directory not found

    Hi Abdul Wahab,

    Try using the following code.

    success: function (data, textStatus, XmlHttpRequest) {
    //This function will trigger asynchronously if the Retrieve was successful
    console.log(data.d);
    }

    Hope this helps.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Error: 404 - File or directory not found

    Please verify if you have defined RecordId.

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

    if (RecordId != null) {

    RecordId = RecordId.replace('{', '').replace('}', '');

  • Verified answer
    Alagunellaikumar Profile Picture
    6,212 on at
    RE: Error: 404 - File or directory not found

    Hi

    Refer the below URL

    rajeevpentyala.com/.../retrieve-record-using-odata-and-jquery-in-crm-2011

  • Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Error: 404 - File or directory not found

    Hi Jason Lattimer

    I use var Object but not luck still it is giving me error.

    Thank You

  • Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Error: 404 - File or directory not found

    Hi Mohd Saad Akhtar

    I have record id.

    Thank You

  • Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Error: 404 - File or directory not found

    Hi Nithya Gopinath

    I used as you suggest but no luck still error.

    Thank You

  • Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Error: 404 - File or directory not found

    Hi  Alagu nellaikumar.S

    There is no error in my code and in my retrieving method, I think so. Am I right?

    Thank You

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Error: 404 - File or directory not found

    Please change your URL like this:

    "/PhoneCallSet?$select=Description,DirectionCode,OwnerId,PhoneNumber,PriorityCode,RegardingObjectId,ScheduledDurationMinutes,Subject&$filter=ActivityId eq guid'" + RecordId + "'"

  • Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Error: 404 - File or directory not found

    Hi Mohd Saad Akhtar, Alagu nellaikumar.S, Nithya Gopinath, Jason Lattimer and All

    I used this code

    function main(){

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

      var query = "BusinessUnitSet?$top=1";

          retriveRecord(serverUrl, query);

    }

    function retriveRecord(serverUrl, query){

    debugger;

    var oDataEndpointUrl = serverUrl + "/XRMServices/2011/OrganizationData.svc/" + query;

    var req = new XMLHttpRequest();

    req.open("GET", oDataEndpointUrl, false);

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

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

    req.onreadystatechange = function () { assignResponse(req); };

    req.send();

    }

    function assignResponse(req) {

    debugger;

       if (req.readyState == 4) {

           if (req.status == 200) {

    var retrieved = JSON.parse(req.responseText).d;

    for (var i = 0; i < retrieved.results.length; i++) {

    }

           }

    else{

    }

       }

    }

    But this code also giving me an error

    CloneCall.png

    I am really frustrating about this issue. Could one know What is the issue behind this? I really need a solution.

    Thank You

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