function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric BlaxtonEric Blaxton 

When is the default Opportunity team added to the Opportunity

I am wanting to use a process / flow when a New Op is created:

1. looks up the current user's default opp team whose member role equals 'Primary SE'
2. populates a custom field on the op with that user

I can get most of it with my current process/flow, but there seems to be an issue.  The issue being that no matter who I login as, the name is being populated with my 'Primary SE'.  

1.  Do I need to be looking up the current user id or is the op id sufficient?
2. When is the default op team assigned to an op?  At creation or when the record is saved?

  
Best Answer chosen by Eric Blaxton
AmulAmul
you have to checked..logged in user that's it.

id currentUser=userinfo.getUserId();

///Trigger Logic

trigger opptyTrigger on Opportunity(before insert){

for(Opportunity opp: Trigger.New){
  opp.Customfield__c=userinfo.getUserId();
}

}