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

Notifications

Announcements

No record found.

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,983 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,983 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans