You need to sign in to do that
Don't have an account?
Gullu Sf
Cannot Read Property 'setParams' of undefined
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();
},
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();
},
You are missing the double quotes in the setParams.
It should be like below:
deleteEvent.setParams({
"entityApiName" : "AccountContactRelation",
"recordId" : ACRId
});
Can you please Let me know if it helps or not!!!
If it helps don't forget to mark this as a best answer!!!
Thanks,
Raj
//This Function is used to invoke the editRecord Event on click of Edit Button.
EditRelation : function(component, event, helper){
//Calling the Salesforce defined Standard Event for editing Record.
var ACRId = event.currentTarget.dataset.value;
//Calling the EditRecord Event.
var editEvent = $A.get("e.force:editRecord");
//Setting the Params for the Edit Record Action.
editEvent.setParams({
recordId : ACRId
});
//Firing the Event.
editEvent.fire();
},
Is it work or not with the double quotes?