Workaround: Refresh Custom LWC on Change of Data in Standard Components or Backend Updates in SFDC

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 20

  • @DineshKumar-hh8pq
    @DineshKumar-hh8pq 9 днів тому +1

    Hi is this the only way to check if a record is updated in detail using lwc. Is there any optimization available now. Thank you in advance

    • @SalesforceBolt
      @SalesforceBolt  5 днів тому +1

      There are many ways to check if record is getting updated, are you looking for a specific scenario?

  • @ruchitham9487
    @ruchitham9487 3 місяці тому +2

    Thank you for sharing this ❤

  • @Chitrapadi
    @Chitrapadi 8 місяців тому +1

    This is exactly the usecase i am working on, thanks mate for this work around🙌

  • @guerrdev
    @guerrdev 4 місяці тому +3

    I tried to do this and it works but only for the admin, I gave access to the Apex Classes to the profile of the user which cannot see the changes with the refresh, but still does not work

    • @SalesforceBolt
      @SalesforceBolt  4 місяці тому +2

      Does your user has access to Platform Events as well?

    • @guerrdev
      @guerrdev 4 місяці тому +1

      @@SalesforceBolt I tried to look for that permission, but I could not find it, where is it?

  • @roysan896
    @roysan896 4 дні тому

    It didn't work for me the callBackFunction never called and refreshmydata() eventually not called either for my case. My usecase was my custom component is showin contact name and accountname and in contact name i have a type attribute link which opens current contact in a standard salesforce edit record as popup like normal standard behaviour.
    But even after save custom component didn't refresh... It's not a full proof solution i think. Please check..

  • @penkogadzhev9805
    @penkogadzhev9805 4 місяці тому +2

    Thanks for sharing this

  • @samirshaikh9201
    @samirshaikh9201 8 місяців тому +3

    What is solution if we are not using wire decorator to fetch records? In that case we can not use refreshApex

    • @SalesforceBolt
      @SalesforceBolt  8 місяців тому +1

      To refresh the cache while calling a method imperatively you can use notifyRecordUpdateAvailable(recordIds)

  • @vetealaurent3380
    @vetealaurent3380 7 місяців тому +3

    hello thanks for the video, we are using this same workaround however we are hitting limits in terms of event listened. It seems that when all users have the component active, if one event is published all the users will receive it hence reaching limits super fast when you have undreds of user working at same time. Any idea on how to proceed ? thanks

    • @SalesforceBolt
      @SalesforceBolt  7 місяців тому

      Yes that's true as all the components will be listening to the same event. You can restrict user's event listening by checking for a specific permission assigned to users so that it won't trigger for all the users in the org... or we can also add filter to trigger the event on some specific field updates instead of having it for all field updates.

  • @yashsrivastava4803
    @yashsrivastava4803 8 місяців тому +2

    Do we have any way to fire an event on standard flexipage tab change to reload a lwc component ?

    • @SalesforceBolt
      @SalesforceBolt  8 місяців тому

      Unfortunately for standard tab we don't have any event yet.

  • @roysan896
    @roysan896 8 місяців тому +1

    Empapi can do this i think.

    • @SalesforceBolt
      @SalesforceBolt  8 місяців тому

      Yes using emp api also you can subscribe to it.