Custom Visibility Code

Hi Everyone,

Does anyone know if it's possible to have custom visibility code that will show a module results in the sub panels under a record but not allow the user to open that result or view the result in a report unless that have access to the team associated with the result? Hopefully the example below makes sense.

Example:

Organization #1:
Opportunity 1 - Blue Team
Opportunity 2 - Red Team

In the example above, I would want to open up organization #1 and see both opportunities below it. However if I am only on Red team then I should not be able to open up Opportunity 1 as it is assigned to Blue team or see it in a report.

Thanks in advance!

Parents
  • Hello to anybody who found this article.

    I've done something similar (if I got the question right) by creating custom link file:

    class CustomDisableTeamsLink extends Link2 {
        /**
         * @see Link2::buildJoinSugarQuery()
         */
        public function buildJoinSugarQuery($sugar_query, $options = []) {
            if ($sugar_query->from->module_name === '<moduleInSubpanel>') {
                // disable teams
                unset($sugar_query->join[strtolower($this->getRelatedModuleName()).'_tf']);
            } else {
                return parent::buildJoinSugarQuery($sugar_query, $options);
            }
        }
    }

    (Don't forget to override the subpanel to use this custom link.)

    The only issue is, it opens preview when clicking the preview icon.

    Best regards,
    Jakub

  • Hi Jacub,

    where did you locate CustomDisableTeamsLink.php file? 

    I have placed my custom file into custom/modules/Accounts, gave it namespace

    Sugarcrm\Sugarcrm\custom\modules\Accounts

    but after R&R instance get broken and error in logs:

    AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class "extendedSubpanelLink" not found in /home/websites/speedpanel.loadedstage.com/wwwroot/include/MetaDataManager/MetaDataConverter.php:338

Reply
  • Hi Jacub,

    where did you locate CustomDisableTeamsLink.php file? 

    I have placed my custom file into custom/modules/Accounts, gave it namespace

    Sugarcrm\Sugarcrm\custom\modules\Accounts

    but after R&R instance get broken and error in logs:

    AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class "extendedSubpanelLink" not found in /home/websites/speedpanel.loadedstage.com/wwwroot/include/MetaDataManager/MetaDataConverter.php:338

Children
No Data