4

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.)

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.

  • Added the new trailhead link into your answer – Brian Miller Apr 21 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

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.