How to inherit Primary Team from related (Parent) record via Logic Hook?

Hello, 

My scenario is the following:

1. We have Teams defined by regions (Africa, Asia, Europe...etc.)

2. For each Teams added some users.

3. An Account created (which is located in Europe) and manually set up the Team for Europe.

If I create a child record - a new Contact or Opportunity - I would to automatically inherit the Team settings from the Account module.

Cause if the Account is located in Europe then the Opportunity is surely goes to the same Team.

We have many custom modules, this function would be ease the managment.

I have read the Knowledge base articles but cant figure out how to do that:

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.7/Architecture/Teams/Manipulating_Team… 

https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Module_Framework/Logic_Hooks/Module… 

In FAQ recomended to do this via after save logic hook, but I dont know how to achieve it.

I think I have to get the team_id from the related Account module and replace the current records team_id

$Accounts_team_id

$Current_team_id

But Im not sure...

Pleasen, anyone, can help?