No announcement yet.

Sub Accounts

  • Filter
  • Time
  • Show
Clear All
new posts

  • Sub Accounts

    It would be great to have subaccounts. Right now I have a main account with 25 different sub-accounts. It is tough when filtering because I have to add each account individually. It would be a great addition!


  • #2
    I very doubt that this feature to be added this. You can create it yourself if you want it, it not difficult I suppose.

    Just create a Relationship - One-to-Many, then drag and drop the field into your layout.

    Now you can add all "Sub/Child" account to "Main/Parent" accounts. That what I'm doing at the moment, because some business/account is linked to Trading name of the main company, I also use it for "Branches" too. For example:

    >EspoCRM - Country A
    >EspoCRM - Country B


    • #3
      The problem with this solution is how the roles are handled. The parent role should be able to inherit all roles for the subaccounts as well but it does not. Right now I have 25 sub-accounts and I have to add those accounts to each user that is part of the parent account. This becomes increasingly frustrating as growth occurs.

      This is not efficient.



      • #4
        That sound like a pain and it would be a good example for it usage.

        In the meantime I suppose you have to use Workflow and/or Formula as a temporary workaround solution.


        • #5
          The parent role should be able to inherit all roles for the subaccounts
          Assuming that you have created a custom SubAccount entity linked in a Many-to-One relationship to Account, I think that you can clone the parent account entity permissions (which are actually linked to the team membership), every time that you instantiate a new sub-account object by creating a hook for the sub-account entity as follows.

          PHP Code:

          namespace Espo\Custom\Hooks\SubAccount;


          SubAccountHooks extends \Espo\Core\Hooks\Base

              public function 
          beforeSave(Entity $entity, array $options=array())
          $entity->isNew()) {
          // get the parent account object
          $parentAccount $this->getEntityManager()->getEntity('Account',$entity->get('accountId'));
          // get the teams to which the parent account is linked 
          $parentTeamIdList $parentAccount->getLinkMultipleIdList('teams');
          // link those teams to the new sub-account
          foreach ($parentTeamIdList as $teamId) {
          ​​​​​​        }            


          • #6
            Hello all,

            Apologies for reopening such an old post but I am trying to get this figured out again.

            I have a parent account that has many accounts under it. Right now, I use those to establish Portal Users. The big problem is that one account may have 100 sub accounts with different portal users under those.

            Can anyone think of a good way to organize that? I am really struggling to get my Account entity organized.

            Thanks as always!