2

JavaScript controller

createCC:function(component,event,helper){
    let ccbhold = component.find("Ccommentbody").get("v.value");
    let phold = component.get("v.Cispublished");
    let idhold = component.get("v.recordId");

    var action = component.get("c.createccapex");
    action.setParams({parentid : idhold, ccbody : ccbhold, bpublic : phold});

    action.setCallback(this,function(response){

        var state = response.getState();

        if(state === "SUCCESS"){
            component.set("v.showcreatemodal", false);
            $A.get('e.force:refreshView').fire();

        }
    })
    $A.enqueueAction(action);
}

Apex Controller:

@AuraEnabled
public static void createccapex(ID parentid, String ccbody, Boolean bpublic){
    Casecomment cc = new Casecomment();
    cc.parentid = parentid;
    cc.CommentBody = ccbody;
    system.debug(bpublic);
    cc.ispublished = bpublic;
    insert cc;
}

The record inserts properly, the modal window closes, the refresh happens, but only on the header and the right bar.

the only thing that doesn't refresh is the parent component(which is a tab on the detail page of the record.

  • the parent component should listen to the refresh event. Which component is it? – Itai Shmida Mar 25 '18 at 10:34
  • its the component itself that doesn't refresh. I fixed it in my code by running init again as well as forcing a refresh. – Tim Willis Mar 26 '18 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.