How to redirect view when record deleted in javaScript in Power Apps
Here is the cide. You have to use NavigateTo API.
JavaScript
function deleteSelectedCard(formContext) {
var currentCardRecId= formContext.data.entity.getId().replace("{","").replace("}","");
var confirmStrings = { text:"Are you sure you want to delete the card?", title:"Think Twice" };
var confirmOptions = { height: 200, width: 350 };
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {
if (success.confirmed)
{
Xrm.WebApi.deleteRecord("sbi_sbicard", currentCardRecId).then(
function success(result) {
alert("Record Deleted Successfully");
var pageInput = {
pageType: "entitylist",
entityName: "sbi_sbicard"
};
Xrm.Navigation.navigateTo(pageInput).then(
function success() {
// Run code on success
},
function error() {
// Handle errors
}
);
// perform operations on record deletion
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
}
else
console.log("Dialog closed using Cancel button or X.");
});
}
JavaScript