0

In Detail-record page, where you can see (activityTracking page and related list) and on header of the page there is new case button to create a new case record.

I have an activityTracking page(lightning component) that display a Child object activity (Tracking of record page)details. Whenever detail page is opened, it automatically retrieve the record ID of that detail page and display those records(Activity) in activity component.

Instead of doing manual refresh, I want it to auto refresh the activityTracking page(lightning component) to view the case record by using NEW CASE button.

ActivityTrackingPage is a lightning component, where I need to write a code for auto refresh process.

Need suggestion please....

  • What does the button do? Is it a standard button or a Lightning component? – David Reed May 31 at 18:18
  • 1
    I would say get rid of the standard button and add a button to your lightning component. That way the lightning component can re-render itself once the case is created. – gNerb May 31 at 21:51
  • We can't remove the standard button as it is not on its own. there are some other buttons included. – Ajay May 31 at 21:57
1

The only reasonable route I see here, if the process for creating a Case is not under your control, is for your Lightning component to embed the <lightning:empApi> event streaming service.

You can then either

  1. use the Streaming API to subscribe to notifications about record creation events or
  2. write an Apex trigger that implements custom logic on the creation of your Support Case records to fire a Platform Event, to which the empApi component subscribes.

Your JavaScript callback from the empApi component can then take action to refresh your activity view upon receipt of one of those events.

The only other feasible solutions I see are:

  1. Polling. I wouldn't recommend it.
  2. If and only if the data model permits - that is, if Support Case is a child object in a master-detail relationship - you could create a Roll-Up Summary Field and then use <force:recordData> to watch for change events in the parent object's roll up field, representing creation events for the child object. I think it's unlikely that that applies here.
  • Thanks for your response. I am aware of steaming Api and platform event concept, do you have any reference doc for solve this, – Ajay Jun 2 at 9:24
  • @Ajay There is no documentation that I am aware of that specifically covers this problem. You would need to do some work that combines different Salesforce features, including events and Lightning client-side controller work. – David Reed Jun 2 at 15:51
  • If you see the Lightning Experience roadmap , what you want is called Live Record . Salesforce has not set any timelines for it – Pranay Jaiswal Jun 3 at 10:21
  • @DavidReed I have tried with some code and its working too but initially when i tried to insert the record its throwing error but after closed that error and tried second time, its working. salesforce.stackexchange.com/questions/264754/… please check for more info – Ajay Jun 5 at 6:29
  • @PranayJaiswal, I did with lightning empApi , please have a look this link and let me know any correction if needed please salesforce.stackexchange.com/questions/264754/… – Ajay Jun 5 at 6:30

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.