0

I know it's hard to answer this without any context, but I have built a Lightning Component that displays order information. Users can input and modify fields on this Lightning Component, and save that information(that save commits the record values and refreshes the Lightning Component). Once that information is saved, a web service takes those values, sends them over to another db, returns a value, and then writes that to the record. The issue im having is that the web service doesn't perform fast enough to write these values to the record before the Lightning Component is refreshed.

I'm just using $A.get(‘e.force:refreshView’).fire(); Is there anyway to limit this to a couple seconds to get the values from the web service?

1
  • 2
    Can you get a callback and only try to use $A.get(‘e.force:refreshView’).fire(); when your callback is success or it returns something?
    – 7'7'
    Commented Mar 21, 2019 at 6:07

1 Answer 1

1

In Winter '19, it would make sense to use the new lightning:empApi component to listen for the changes from the server. For now, if you have an estimated amount of time, you can use setTimeout:

setTimeout(
  $A.getCallback(function() {
    $A.get('e.force:refreshView').fire();
  }), 5000); // Waits 5 seconds

You must log in to answer this question.

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