3

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?

0

2 Answers 2

4

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/docs/atlas.en-us.lightning.meta/lightning/ref_force_refreshView.htm

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.

3
  • 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, 2018 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 Apr 12, 2018 at 22:13
  • 1
    @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!! Apr 14, 2018 at 23:44
0

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.

You must log in to answer this question.

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