Announcement

Collapse
No announcement yet.

Custom views/app.js

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom views/app.js

    Hi!

    I want to override requestUserData method in app class. I want to add some data to cache after this method has executed.
    The question is how can I define new path "custom:views/app" like we do with entity views?

  • #2
    Hi,

    There's no official way to override core classes. It's on purpose, the official way of extending is we giving guaranties that the customization is future proof (to an extent).

    You can try monkey patching, but I don't recommend. https://forum.espocrm.com/forum/deve...avascript-code

    Comment


    • #3
      I got you. Maybe there is another way to set this data? The problem is as follows: I have relation with user, which is changed very rarely, but also I use this data, when rendering buttons on different views, so I want to set it to cache once the user is set to lighten load on back-end and client rendering
      Last edited by a.slyzhko; 01-12-2024, 09:55 AM.

      Comment


      • #4
        Use App Params. https://docs.espocrm.com/development/app-params/. If you want to cache, cache it on the backend and serve the cached value.

        Comment


        • #5
          Do I have to just inject Psr\Cache\CacheItemPoolInterface to use cache?

          Comment


          • #6
            We don't support CacheItemPoolInterface. Consider Espo\Core\Utils\DataCache.

            Comment


            • #7
              Cool, thank you very much!

              Comment

              Working...
              X