0

Requirement: I need an LWC on Case record lightning page which should listen to another table called customobj1__c and display just the most recent record in that table. When the most recent record in customobj1__c table is updated by navigating to the detail page of that record I want the LWC which is on the Case record page to auto re-render and show the updated data.

Question: I tried using wire service to get this to work. I tried wire to property, wire to a function using a custom apex method but it didn't work for some reason. I read in documentation that wire service provides immutable data so I don't know if this is the way to go. I also tried getRecord of uiRecordApi and wired it to a property and a function both of them didn't work. How can we achieve this requirement?

1 Answer 1

1

You can hook up to to changes using the emp api and trigger refreshes to your LWC based on x criteria (this is generally in the form of an SOQL query)

So, you subscribe to a channel that listens for changes, and can handle your logic on the client.

3
  • That's a good thought. But looks like there are hourly limits on no.of events. We have almost 2000 users interacting with this table very frequently. So, I am guessing we will run into this limit pretty soon Commented May 12, 2021 at 15:37
  • you can poll the server from the client every couple of minutes, but it's not the best approach.
    – glls
    Commented May 12, 2021 at 15:41
  • Yeah I thought about that as well. We already have a couple other components doing that so I don't want to add another especially when something out of the box like LDataService can do this. Can you think of another approach? Commented May 12, 2021 at 15:46

You must log in to answer this question.

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