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 risposte
  1. 31 ago 2018, 14:38
    Hi,

     

    The reason you getting this error is because there is no standard event to delete the records.

     

    force:deleteRecord doesn't exist. That's why you are getting NULL in deleteEvent.

     

    To delete the record, you will need to pass the recordId in a apex class method.
0/9000