5

I'm using Lightning Data Service in a component. It all works well. One item I've noted is that it does not seem to detect changes to fields which may have occurred via a trigger or workflow after a standard record save for a component I have on my record detail page. Should the "recordUpdated" function within force:recordData detect this? If not is using component.find("forceRecord").reloadRecord() the recommended approach? If so how do I detect when to fire this?

Thank in advance (& apologies if the answer should be obvious but I have not noted one.)

2 Answers 2

1

According to this Trailhead Step

Use Lightning Data Service and Communicate Between Components

force:recordData automatically retrieves the record specified by its recordId attribute, and then stores that data in the <aura:attribute> defined by the targetRecord attribute. Then force:recordData begins to listen for changes to that record made by other components on the page, and fires the JavaScript function defined by the recordUpdated attribute when it detects a change.

You can use force:recordData with recordUpdated to make actions when detected a change in all the record fields.

1
  • 1
    Added the new trailhead link into your answer Apr 21, 2019 at 19:56
0

I believe your best bet at this is using the recordEditForm component. It has some "on" events (like "on success", "on error"...) which you can make what you need to do (like reloading the component or just some data).

The best approach is to handle the callback from the server request using the available "on" attributes.

Check this: https://developer.salesforce.com/docs/component-library/bundle/lightning:recordEditForm/specification

You must log in to answer this question.

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