Skip to main content
Hi There! I'm using standard events to create, edit, navigate and delete functionality. The Create, Edit and Navigate functions are working perfectly but when I come to deleting the record, I get an error saying cannot read property 'setParams' of Undefined. Can anyone tell me why it is throwing this error. I dont understand why its not working for delete. below is the js function for delete. I've printed out the recordId when I click on delete button and it is showing the correct recordId. If this is not working then I might have to pass the recordId to apex controller and delete it in a method, But I wanted to use the Salesforce Standard Event for Deleting the record as well. 

Thanks

DeleteRelation : function(component, event, helper){

        

        //Calling the Salesforce defined Standard Event for deleting Record.

        var ACRId = event.currentTarget.dataset.value;

        console.log("deleterecord"+ACRId);

        //Calling the EditRecord Event.

        var deleteEvent = $A.get("e.force:deleteRecord");

        //Setting the Params for the deleteEvent Action.

        deleteEvent.setParams({

            entityApiName : "AccountContactRelation",

            recordId : ACRId 

        });

        //Firing the Event.

        deleteEvent.fire();

        

    },   
5 个回答
0/9000