Announcement

Collapse
No announcement yet.

Add default filter options

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

  • Add default filter options

    Upon creating a meeting, I need to filter the users attendees by default using the title field. This means that when you create a meeting and select the users, already a filter is being applied (title equals to a string).

    What is the correct way to do this? I have tried several options with custom views and none have worked.


  • #2
    I think you just missed something, this is how you can do it, follow steps below and use code below and it will work (i have tested it).

    1 - Create a meeting.json under custom\Espo\Custom\Resources\metadata\entityDefs and use code below (if this field already exist just add the users field only to the fields section of your json file.

    PHP Code:
    {
        
    "fields": {
            
    "users": {
                
    "view""custom:views/meeting/fields/users"
            
    }
        }
    }
    ​ 

    2 - Create the custom view for user field which will extend existing users and only add a filter for the title as below, create a users.js under client\custom\src\views\meeting\fields and use code below (Create the folders if they don't exist)
    PHP Code:
    define('custom:views/meeting/fields/users',  ['crm:views/meeting/fields/users'], function (Dep) {

        return 
    Dep.extend({

            
    getSelectFilters: function(){
                return {
                    
    'title': {
                        
    type'equals',
                        
    value'Manager'
                    
    }
                }
            }
        });
    });
    ​ 

    Change the string in the value to whatever string you need.

    Clear cache and rebuild the system and it should work

    Hope this helps
    Rabii
    Web Dev

    Comment


    • #3
      hi rabii nice to see you again

      i want to ask what if the case is i want to do it in the sidepanels/detailsmall section. which i want to apply it in selecting an account where this account has been selected in its parent before but in sidepanels/detaillsmall i want to use the account data to be selected again in sidepanel/detailsmall again​

      Comment


      • rabii
        rabii commented
        Editing a comment
        If i understand, when a Coupan Ads record has an account selected and then when creating a related (Outlet) you want the account to be passed to the detailSmall and be set there ? Is this what you want ?

      • rabii
        rabii commented
        Editing a comment
        If that is what you want then what i shared above with Polea is not what you need. you just need to add a createAttributeMap to the relationship (outlets) on your clientDefs > Coupanads.
        Last edited by rabii; 10-23-2024, 08:03 AM.
    Working...
    X