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

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

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 185 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 110

#3
Gerardo Rentería García Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans