Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error: 404 - File or directory not found

Posted on by 12,070 Super User 2024 Season 1

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

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

    I'm getting a similar 404 issue with the following JavaScript, any help is most appreciated.

          SDK.REST.retrieveMultipleRecords(

               'CustomerAddress',

               "$select=" + selectStr + "&$filter=(ParentId/Id eq (guid'" + customer[0].id + "')) and ((Name ne null) or (Line1 ne null) or (City ne null))" + filterString,

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

    Hi Abdul Wahab,

    Please try using the below URL in your browser.

    OrganisationRootURL/.../PhoneCallSet

    With one of the guid you get from the URL above (say, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx), try the following URL.

    OrganisationRootURL/.../PhoneCallSet(guid'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')

    Please let me know are you able to fetch data using the URLs above?

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error: 404 - File or directory not found

    Hi Nithya Gopinath

    CloneCall1.png

    Thank You

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

    Hi,

    Can you please provide a screenshot of the Developer Resources window in Settings --> Customization ?

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error: 404 - File or directory not found

    Hi all

    When I use the URL with s It is giving me this eror: XMLHttpRequest: Network Error 0x80070005, Access is denied.

    Where should I wrong?

    Thank You

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error: 404 - File or directory not found

    Hi all

    What is the problem? Any one knows?

    Thank You

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error: 404 - File or directory not found

    Hi Nithya Gopinath

    When I delete s from this URL in code awwww/.../&; + query. It will start giving me 404. What is wrong? May you please help me more?

    Thank You

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error: 404 - File or directory not found

    Hi Nithya Gopinath

    There is a problem in URL. When I used this awwww/.../BusinessUnitSet$top=1

    It will work and show me the record but When I use this "awwww/.../BusinessUnitSet$top=1" it gave me the erro

    I hard code this var oDataEndpointUrl = "crm03/.../&quot; + query;

    It gave me exception Network error. What is wrong? Please help me more.

    Thank You

  • Suresh Sorde Profile Picture
    Suresh Sorde 1,075 on at
    RE: Error: 404 - File or directory not found

    As per me you have missed the function  for readystate.

    req.onreadystatechange = function () {

           assignResponse(this);

       };

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

    Hi Abdul Wahab,

    I think the problem is with the URL. Can you just type the URL in the browser and see if something is getting retrieved using OData. Just a part of the URL is required.

    myorg.crm.dynamics.com/.../PhoneCallSet

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans