I have a custom component which shows all tasks on the case. Now whenever a new task gets created by log a call then I would like to refresh the developed custom component to reflect the newly created task.

Is there any way to listen for the record create event in lightning?


Whenever Standard Components do job , they fire refreshView event. You can create a handler which listens to that event and refreshes your component individually.

<aura:handler event="force:refreshView" action="{!c.doInitInCustomComponent}"/>


SRC: https://developer.salesforce.com/forums/?id=906F0000000DDaqIAG

As gNerb suggest you should prefer using Lightning Data Services as they handle such changes quite brilliantly few people have encountered bugs while capturing refreshView events.

  • I suspected something like this but couldn't find any documentation, I believe you're correct, but even the documentation you linked doesn't actually support your claim. – gNerb Apr 12 '18 at 22:11
  • 1
    updated links. Couldnt not find the link in Lightning Component Guide. But Found it in forum. I swear I had read in Component Devloper guide, :/ Thanks – Pranay Jaiswal Apr 12 '18 at 22:13
  • @PranayJaiswal Thank you, yes you are correct it is firing the refreshView event when I add activity. I have a lex console application and in that if other child record gets created (custom object) then this event is not firing. I assume its an application level event but not sure why it is not firing for related records. This helps!! – Kiran Machhewar Apr 14 '18 at 23:44

You can always hide the "log a call" button and replace it with a custom lightning component that can fire a custom app event that your task component can respond to.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.