0

I have this sample use case:

Component Child - Component

enter image description here

Component Child - Controller JS

enter image description here

Component Parent - Component enter image description here

When I click the button I see the Standard Edit Modal and I can edit the related record and save it.

So I would catch the event about the SaveRecord in the other component but I don't find any solution to do it.

Is it possible or I should find an other way? Thanks!

1

1 Answer 1

1

I had a similar need, and used the Lightning Inspector in Chrome to see what application events were fired by the framework when using standard New, Edit, and Delete features.

I found a few application events that looked interesting, but got errors when trying to save a component that had a handler for them, saying "no such event" (or something similar). The events I could NOT create handlers for were: force:recordSaveSuccess, force:recordChange, force:afterRecordSave, and force:requestLogging. These were events that had payloads with data in them (such as record IDs) that I could have caught and used to refresh related components, but it's not possible to create handlers for these events.

The only event I found that I could create a handler for was force:showToast, and then look for relevant text in the toast message related to the object name, and then refresh accordingly. However, I also discovered that toast messages are only generated for New and Edit, not Delete.

I don't like relying on toast messages from standard features to do refreshes, but I wasn't able to find anything better at the moment.

If anybody has a better way of doing this, please reply with ideas.

1
  • I have found that if you handle the top level application event it will pick up force:recordChange. <aura:handler event="aura:applicationEvent" action="{!c.eventListener}" />
    – ebt
    Jul 17, 2018 at 18:37

You must log in to answer this question.

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