1

I have a component under Utility Bar. When the owner is changed in the case detail. The component needs to pick the latest update and it will show number of cases that logged in user owns.

When i checked this , the doInit method is running just during the entire page refresh. On subsequent clicks on the utility bar option, the init is not getting called.

Is there a workaround for this?

1 Answer 1

3

Are you using Lightning Data Service?
If you use Lightning Data Service (force:recordData) The utility bar component will pick up change.

From Salesforce Docs,

Records loaded in Lightning Data Service are cached and shared across components. Components accessing the same record see significant performance improvements, because a record is loaded only once, no matter how many components are using it. Shared records also improve user interface consistency. When one component updates a record, the other components using it are notified, and in most cases, refresh automatically.

Set "recordUpdated" attribute with an action, Then in that action logic, handle refresh view logic.

Example @ here

EDIT @AjaySFDC @tsalb I think, we can use

<lightning:utilityBarAPI aura:id="utilitybar"/> 

Place it in your Component housed in UtilityBar.

Then, Use onUtilityClick() Method of utilityBarAPI which should register an event handler for Utility click. You can call doInit in that eventHandler logic.

Link 1 Link 2

The above links should help you implement this.

Let me know if it fixes the issue or Did i get it wrong again?

4
  • 1
    depending on how the developer linked certain fields into LDS, a $A.get('e.force:refreshView').fire() is all that's needed
    – tsalb
    Commented Jul 31, 2018 at 20:04
  • @Nithesh : I'm not using LDS here. Because my requirement is to change the ownership from a user to a Queue. So i present a screen with multiple queue selection and a button. When the button is clicked, doInit() is re-invoked. But when you change the owner on the case detail, it is not reflecting in the utility bar when i click on that tab. Even for LDS, a event needs to be fired, and that will work. But for me, when i click on that Utility Bar tab, it should call doInit() again.
    – AjaySFDC
    Commented Aug 1, 2018 at 10:01
  • @tsalb : To add that refresh , doInit() method needs to be fired when the tab on utility bar is clicked everytime. That is not happening. Actions that are performed inside component are working fine and getting refreshed. Utility bar click needs to take an event that calls doInit() method of the client controller. is that possible ?
    – AjaySFDC
    Commented Aug 1, 2018 at 10:03
  • @AjaySFDC I added a new method, Please check the edit and let me know if it is working for you.
    – Nithesh N
    Commented Aug 1, 2018 at 14:03

You must log in to answer this question.

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