web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Gives Bad Request error or Status 400 when we delete the record using CRM Restbuilder.

(0) ShareShare
ReportReport
Posted on by 23

Gives Bad Request error or Status 400  when we delete the record using CRM Restbuilder.

var parameters = {};
parameters.recordId = "029969d6-40f6-ea11-a815-000d3a98d1ad";

var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/ig1_DeleteBidSheetOrTemplate", 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 === 204) {
//Success - No Return Data - Do Something
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(parameters));

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    To Delete record, we don't use Post method instead we need to Delete.

    Check below link.

    docs.microsoft.com/.../update-delete-entities-using-web-api

    DELETE [Organization URI/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001) HTTP/1.1  

    Content-Type: application/json  

    OData-MaxVersion: 4.0  

    OData-Version: 4.0

    Also, Bad request is only status returned from the server. You should use dveloper Tool (Hit F12) to check network tab for more detailed error.

    Code generated from Rest Builder which is completly different that what you have shared in your post.

    var req = new XMLHttpRequest();
    req.open("DELETE", Xrm.Page.context.getClientUrl()   "/api/data/v9.1/accounts(00000000-0000-0000-0000-000000000000)", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.onreadystatechange = function() {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 204 || this.status === 1223) {
                //Success - No Return Data - Do Something
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send();

    Please mark my answer verified if i were helpful

  • Rahul Rathore Profile Picture
    23 on at

    We are calling the plugin using Action. the plugin returns the following error.

    'ig1_bidsheetpricelistitem' entity doesn't contain attribute with Name = 'ig1_bidsheetid' and NameMapping = 'Platform'. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=37633870, MinActiveRowVersion=37633870, MetadataInstanceId=31980349.

  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    In that case you should debug your plugin to check the issue.

    Please mark my answer verified if i were helpful

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 60 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 43

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans