Skip to Content
Menu
This question has been flagged
1 Reply
2335 Views

Is it possible to add all of the members of a sales team as followers to every new opportunity created for their sales team?


We have three sales teams and one of them is very small (with only three members) and they all collaborate on the opportunities. It would be very helpful if when one of the team members creates an opportunity from a lead, the other two team members are automatically added as followers.



Avatar
Discard
Best Answer

Hello, 

You can use this code in your automated action, all you need to know is the id of your sales team:

# if the sales team is equal to the team with id 1
if record.team_id.id == 1:
  # get all employees contacts on sales team and add to record
  contact_ids = record.team_id.member_ids.mapped("partner_id")
  record.message_subscribe(contact_ids.ids)
Here is a screen shot of how my automated action was set up, and everything seems to be working as expected. Where the users of the sales team are added to the lead. 


To find the Id of the sales team you can look at the URL and the parameter (id=x) will let you know when you are on the sales team form view. 


I hope this helps,

Thanks, 

Avatar
Discard
Author

This worked perfectly! Thank you very much Jack