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.");
       });
}

HOW TO REDIRECT VIEW WHEN RECORD DELETED IN JAVASCRIPT IN POWER APPS

https://www.youtube.com/@powerappsninja

Leave a Comment

Your email address will not be published. Required fields are marked *