Announcement

Collapse
No announcement yet.

User List by Team

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

  • User List by Team

    Hi,
    I want to list the users in that team according to the selected Team.
    To do this, I added code to the assigned users fields section. (Changed).
    But I don't know how to push it into users modal. Please help.

    Code:
    Espo.define('views/fields/assigned-user', 'views/fields/user-with-avatar', function (Dep) {
    
        return Dep.extend({
    
            init: function () {
                this.listenTo(this.model, 'change:teamsName', function (e) {                
                    $.ajax({
                        url: 'User?filterList[]=internal&select=name&orderBy=userName&order=asc&where[0][type]=linkedWith&where[0][attribute]=teams&where[0][value][]='+e.changed.teamsId,
                        type: 'GET',                    
                        dataType: 'json',
                        async: true
                    }).done(function (res) {
                        console.log(res.list);
                    }.bind(this));
                }, this);
    
                this.assignmentPermission = this.getAcl().get('assignmentPermission');
                if (this.assignmentPermission == 'no') {
                    this.setReadOnly(true);
                }
                Dep.prototype.init.call(this);
            },
    
            getSelectBoolFilterList: function () {
                if (this.assignmentPermission == 'team') {
                    return ['onlyMyTeam'];
                }
            },
    
            getSelectPrimaryFilterName: function () {
                return 'active';
            }
    
        });
    });

  • #2
    Okay, I Fixed.

    with "getSelectFilters" function... thank you for your help

    Comment

    Working...
    X