An opportunity team is a set of users that normally work together on sales opportunities. A typical opportunity team might include the account manager, the sales representative, and a pre-sales consultant. As soon as you assign members in your Opportunity team and if you want to assign some task to them, So you can’t achieve this by using Workflow because there is no such option for task assignment / New Task for ‘Opportunity Team Member‘.
To achieve this you have to write Apex trigger. Below is the sample code you can modify it according to your requirement.
trigger TaskOnOppTeamMember on OpportunityTeamMember (after insert) { list<Task> NewTask = new list<Task>(); if(trigger.IsInsert) { for(OpportunityTeamMember oppTeam : trigger.new) { Task tasksInsert = new Task(); tasksInsert.WhatId = OppTeam.Opportunityid; tasksInsert.OwnerId = oppTeam.Userid; tasksInsert.Subject = 'Great Daddy'; tasksInsert.ActivityDate = date.today(); tasksInsert.Priority = 'Normal'; NewTask.add(tasksInsert); } } Database.insert(NewTask); }
Now navigate to your opportunity detail page Under Opportunity Team related list Click on “Add” Button.
Select the User Name, Opportunity Access, and Role and click on”Save” button. Now navigate to Open Activity related list and cheers.