onUpdateCaseDetails: function () {
var sIncidentType1 = "Akash123";
var sCaseID = "UHEALTH-INVESTIG-WORK I-61005";
var sActionID = "pyUpdateCaseDetails";
var sUrl = "https://leaseplan01.pegalabs.io/prweb/api/application/v2/cases/" +
encodeURIComponent(sCaseID) +
"/actions/" +
encodeURIComponent(sActionID) +
"?viewType=form";
var sBearerToken = "XXXXXXXXX"; // your full token
var oPayload = {
content: {
IncidentType: sIncidentType1
}
};
$.ajax({
url: sUrl,
method: "PATCH",
contentType: "application/json",
data: JSON.stringify(oPayload),
headers: {
"Authorization": "Bearer " + sBearerToken,
"If-Match": "20250820T072129.183 GMT",
"x-origin-channel": "Web",
"Content-Type": "application/json",
"Accept": "application/json"
// "Access-Control-Allow-Origin" :"*"
},
success: function (oResponse) {
MessageToast.show("Case updated successfully!");
console.log("Update response:", oResponse);
},
error: function (oError) {
MessageToast.show("Update failed: " + oError.statusText);
console.error("Update error:", oError);
}
});
},
Request clarification before answering.
Hi @Akash_Kanyadhara i think This is a CORS issue. The browser sends a preflight OPTIONS request for your PATCH with custom headers, and the API response does not include the required CORS headers. You cannot fix this in UI5 code alone. You must either enable CORS on the API or call it through a proxy on BTP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.