sugarcrm filter on relative field

How can i add  filter on related field  .  like I have user type related field on which I have want to show only user related user with some role  . how is this possible  ?

i tried through this 

https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/1209/how-to-add-an-initial-filter-to-studio-created-relate-field-drawers

bt not working 

Parents
  • You can extend the vardef file to add a "filter_definition". For example, in the field custom/Extension/modules/<module>/Ext/Vardefs/sugarfield_<field_name>.php, you can add something like:


    $dictionary
    ['<module>']['fields']['<field_name>']['filter_definition'] = [
    [
    'aclroles.name' => '<role_name>'
    ]
    ];

    Then do a quick repair and rebuild - and by default, it will auto-filter based on the definition above - but this doesn't enforce the filter, users are free to remove the filter and set any record they want, but the default search will filter by the role you specify.

  • Well, I guess you can do an onlyread field, as same as you do with the relationship of the role field you can do with readonly.
    If I am sure you must do 

    $dictionary['<module>']['fields']['<field_name>']['filter_definition']['readonly'] = true;

    And that converts the field in a simply label, not editable by the user.

Reply Children
No Data