This is driving me insane - I'm sure I'm overlooking something simple here. I have simplified a component to isolate the issue, down to two basic operations: insert and delete. Insertion is working 100% perfectly fine. However, the delete method with nearly identical syntax will simply not work - the client-side method is called, because the alert(recId) is appearing and showing the correct Id value, and the window is reloading - but the Apex method is never firing server-side, and the record is never deleted!

I have also double checked that there is no trigger or other logic blocking the deletion of Notes in this org - if I delete the Note using Execute Anonymous, it works fine.

Any insight would be greatly appreciated.

Client-side controller:

addNote : function(component, event, helper) {
    var action = component.get("c.createNote");
    var title = component.find("noteTitle").get("v.value");
    var body = component.find("noteBody").get("v.value");
        "title" : title,
        "body" : body
deleteNote : function(component, event, helper) {
    var selectedItem = event.currentTarget;
    var recId = selectedItem.dataset.record;
    alert(recId); // this is correctly showing the right Salesforce Id
    var action = component.get("c.deleteNote");
        "recId" : recId

Server-side controller:

public class SalesCallLogNoteController {

    public static Note createNote(String title, String body) {
        Note n = new Note();
        n.title = title;
        n.Body = body;
        n.ParentId = '0014B00000D8Bx7';
        insert n;
        return n;

    public static Boolean deleteNote(Id recId) {
        Note n = [SELECT Id FROM Note WHERE Id = :recId];
        delete n;
        return true;
  • As an aside, you might have a race condition if you reload before you get a response back from the server. Use action.setCallback to reload after a successful action.
    – sfdcfox
    Commented Mar 7, 2017 at 22:02

1 Answer 1


Your server-side action and the client-side action have the same name: deleteNote. The client-side action is overwriting the client code for the server-side action, so it's calling the client-side deleteNote method over and over instead of making the server call.

If you rename one of them and update the calling code it should work.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .