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

Portals PATCHWeb API showing multiple error messages

(0) ShareShare
ReportReport
Posted on by 50

Hi All, 

I am trying to call Portals Web API for updating a record using below function and i have  a plugin in some cases. I tried to capture error in "error" block and portal is showing plugin error in case of plugin exception. However, it is displaying two alerts 

One for Plugin Exception as Alert

One for common data exception error 

Can anyone help in restricting the multiple alerts 

Below is my code 

function updateCRMRecord(recordObj,tablepluralname,id) {
appAjax('Updating Record', {
type: "PATCH",
url: "/_api/"+ tablepluralname+"("+id+")",
contentType: "application/json",
data: JSON.stringify(recordObj),
success: function (res, status, xhr) {
alert('Success');
},
        error:function(res) {
            var err= JSON.stringify(res);
            var err1 = JSON.parse(err);
            alert(err1.responseJSON["error"]["innererror"].message);
            return;
            console.log(res);
        }
});
return false;
}

Can anyone help how can i stop displaying common data services error alert however need to display inner error

I have already enabled inner error site setting 

I have the same question (0)
  • Suggested answer
    Manoj Mane Profile Picture
    1,020 on at

    Hi,

    please refer the below code snippet:- 

    CrmCController.addComment = function () {
    debugger;

    var dataToUpdate = {
    "new_comment": CrmCController.currentcomment

    };
    webapi.safeAjax({

    type: "PATCH",
    url: "/_api/new_attendeesdetailses(" + eventAttendeeId + ")",
    contentType: "application/json",
    data: JSON.stringify(dataToUpdate),
    success: function (res, status, xhr) {
    console.log(res);
    window.location.href = '/events';
    // $('#mainBodyContainer').hideLoading();

    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
    alert(XMLHttpRequest.responseJSON.error.innererror.message);

    }
    });
    }

    Thanks,
    Manoj.

    Please mark this as VERIFIED if it helps.

  • ingu Profile Picture
    50 on at

    Still i am getting two messages one from plugin exception as alert (working properly) and after i click ok it is again showing common data service error

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 202 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 70

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans