Showing tasks in bottom or side panel of a user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robin
    Junior Member
    • Aug 2025
    • 8

    #1

    Showing tasks in bottom or side panel of a user

    Hi everyone,

    I've come across a rather strange behaviour regarding the relationship between tasks and users.
    My goal is to display a list of tasks, that are assigned to a user in the bottom or side panel of the user detail view.

    Sounds easy enough: a 1:n relationship between users and tasks already exists. So lets go to the layout management of the user entity and add "Tasks" to the bottom or side panel. However after doing that, the tasks list doesnt appear in the record view of any user.

    I tried adding the task view to other entities that already have a relationship to tasks, like contacts. Here it works just as expected, the tasklist appears in the entity view.
    I can also add other lists to the users bottom panel like calls, emails, accounts etc. and they all get displayed correctly.

    The problem only appears with the users <--> tasks relationship. I can view the tasks of a user if i go to the calendar of the user and enable tasks there. However that is not really practical to my use case, since I need a concise list of all tasks, assigned to that user in the detail view of the user.

    My best guess is, that users as well as tasks are a "special" type of entity, so adding the relationship between both to a panel is not as easy as with "normal" entities..

    Our system is curently on version 9.1.8

    Any healp would be greatly appreciated
  • rabii
    Active Community Member
    • Jun 2016
    • 1357

    #2
    The user detail view is not controlled through GUI but rather assigned via code - the side panel (detail side view) is assigned directly as below code below



    and here is the side panel (detail side view) code below



    so in order to change this you will need to create a custom record detail view which extend the existing one and only assign a new custom (detail side view - which also extend the existing one) in your custom detail side view you can add the panel there - see code line below (which already adds the existing relationship of task between user and tasks) - not sure why you try to add new relationship where in fact there is already an existing one.




    Hope this make helps
    Rabii
    EspoCRM & Web Dev

    🔗 See what I’ve built for EspoCRM

    Comment

    • robin
      Junior Member
      • Aug 2025
      • 8

      #3
      Thank you for your response rabii!

      So it hasnt quite resolved my problem yet, but it did get me one step closer.

      I might have been a bit unclear in my original post, but I'm not trying to add a new relationship between tasks and users. I merely want to display the tasks of a user in the sidepanel of the user via the relationship that, as you mentioned, already exist.
      I've looked at the code you referenced and did some debugging and I found the source of my problem.
      Its the following line:


      If userModel exists, the tasks panel is beeing hidden. According to my debugging that explains why the tasks panel is beeing hidden.

      Now I presume this code is there for a reason, so I dont just want to edit the code there. Maybe you could enlighten me, why the tasks panel is beeing hidden there, when the userModel exists?
      And maybe you have an idea how to show the task-panel anyway?

      Thank you for your help!

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1357

        #4
        As far i understand this was done intentionally because the tasks usually belong to Contacts / Accounts / Opportunities (task panel doesn't display parent field) and therefore users are actors, not entities that "own" tasks.

        To show the task you will have to override this behavior either through custom view as mentioned in my previous post or via Monkey patch.
        Rabii
        EspoCRM & Web Dev

        🔗 See what I’ve built for EspoCRM

        Comment

        • robin
          Junior Member
          • Aug 2025
          • 8

          #5
          Thank you for your help. I succesfully managed to show tasks now in the record view of a user.

          The description of the solution (with code and some more detail) as rabii described:
          Step 1:
          create a custom detail-side.js under client/custom/src/views/user/record/detail-side.js that looks like this:
          Code:
          define('custom:views/user/record/detail-side', ['views/user/record/detail-side'], function (Dep) {
              return Dep.extend({
                  setupPanels: function () {
                      const userModel = this.model;
                      if (userModel.isApi() || userModel.isSystem()) {
                        this.hidePanel('activities', true);
                        this.hidePanel('history', true);
                        this.hidePanel('tasks', true);
                        this.hidePanel('stream', true);
                        return;
                      }
                      const showActivities = this.getAcl().checkPermission('userCalendar', userModel);
                      if (!showActivities && this.getAcl().getPermissionLevel('userCalendar') === 'team' && !this.model.has('teamsIds')) {
                        this.listenToOnce(this.model, 'sync', () => {
                          if (!this.getAcl().checkPermission('userCalendar', userModel)) {
                            return;
                          }
                          this.onPanelsReady(() => {
                            this.showPanel('activities', 'acl');
                            this.showPanel('history', 'acl');
                            if (!userModel.isPortal()) {
                              this.showPanel('tasks', 'acl');
                            }
                          });
                        });
                      }
                      if (!showActivities) {
                        this.hidePanel('activities', false, 'acl');
                        this.hidePanel('history', false, 'acl');
                        this.hidePanel('tasks', false, 'acl');
                      }
                  }
              });
          });
          I basically just extend the existing detail-side.js but overwrite the setupPanels function. For the function i just copied it from the original detail-side.js and removed the last part where the task-panel is beeing hidden.

          Step 2:
          create a custom detail-js so the custom detail-side.js is actually beeing used:
          Code:
          define('custom:views/user/record/detail', ['views/user/record/detail'], function (Dep) {
              return Dep.extend({
                  sideView: 'custom:views/user/record/detail-side'
              });
          });
          Step 3: adjust the clientDefs at src/files/custom/Espo/Custom/Resources/metadata/clientDefs/User.json so the new detail.js is beeing used:
          Code:
          {
              "recordViews": {
                  "detail": "custom:views/user/record/detail"
              }
          }​
          ​

          To the background: the reason I want to show tasks in a users view is, that contacts are external persons (customers, partners etc.) while users are actual users of our EspoCRM instance. Since it doesnt make sense to assign tasks to external contacts who dont work with our EspoCRM but rather to the people who are active on the platform, we wanted to show the tasks only for the users entity type.

          Thank you for your help rabii in solving this problem
          Last edited by robin; 11-20-2025, 02:38 PM.

          Comment


          • rabii
            rabii commented
            Editing a comment
            Glad you got it sorted

            and thanks for sharing with the solution with others
        Working...