You need to sign in to do that
Don't have an account?
sfdc007
Trigger Help needed for opp members
Hi,
I need to write a trigger for the below scenario as follows,
Add After Upsert trigger code (SasLineItemAfter) on SAS_Line_Item__c object to upsert SAS_Line_Item__c .SAS_Assigned_SA__c into the SAS_Line_Item__c.Engagement_Script__c.Opportunity__c Sales Team. We are not going to remove Sales Team if the SAS_Assigned_SA__c is changed to somebody else. Watch for Sales Team validtions that may come up. We don’t want those validations to just pop unhandled in the inline VF. We should trap those errors gracefully.
Add SA(s) from the Assigned SA field of the TF to the Opportunity Sales Team (on the Opportunity) with:
Existing Assign SAs will not be added to the Opportunity Sales Team
I have written th e below trigger . but not sure if its right , kindly help me on this issue
MY TRIGGER :
trigger OTOpportunityTrigger on SAS_Line_Item__c (before update) {
List<OpportunityTeamMember> listOpptyTeamMem = new List<OpportunityTeamMember>();
Set<Id> OpptyIdSet = new Set<Id>();
for(SAS_Line_Item__c sas : trigger.New)
{
//Checking Oppty SecondaryOwner
if(sas.SAS_Assigned_SA__c != null)
{
OpportunityTeamMember OTM = new OpportunityTeamMember();
OTM.UserOrGroupId = sas.SAS_Assigned_SA__c;
OTM.Status ='Active';
OTM.TeamMemberRole = 'Tier 2/3 SA';
OTM.OpportunityAccessLevel = 'Read/Write';
listOpptyTeamMem.add(OTM);
if(listOpptyTeamMem.size() > 0)
insert listOpptyTeamMem;
}
}
}
Kindly help me pls
Thanks in advance
I need to write a trigger for the below scenario as follows,
Add After Upsert trigger code (SasLineItemAfter) on SAS_Line_Item__c object to upsert SAS_Line_Item__c .SAS_Assigned_SA__c into the SAS_Line_Item__c.Engagement_Script__c.Opportunity__c Sales Team. We are not going to remove Sales Team if the SAS_Assigned_SA__c is changed to somebody else. Watch for Sales Team validtions that may come up. We don’t want those validations to just pop unhandled in the inline VF. We should trap those errors gracefully.
Add SA(s) from the Assigned SA field of the TF to the Opportunity Sales Team (on the Opportunity) with:
- Status = Active
- Team Role = Tier 2/3 SA
- Opportunity Access = Read/Write
Existing Assign SAs will not be added to the Opportunity Sales Team
I have written th e below trigger . but not sure if its right , kindly help me on this issue
MY TRIGGER :
trigger OTOpportunityTrigger on SAS_Line_Item__c (before update) {
List<OpportunityTeamMember> listOpptyTeamMem = new List<OpportunityTeamMember>();
Set<Id> OpptyIdSet = new Set<Id>();
for(SAS_Line_Item__c sas : trigger.New)
{
//Checking Oppty SecondaryOwner
if(sas.SAS_Assigned_SA__c != null)
{
OpportunityTeamMember OTM = new OpportunityTeamMember();
OTM.UserOrGroupId = sas.SAS_Assigned_SA__c;
OTM.Status ='Active';
OTM.TeamMemberRole = 'Tier 2/3 SA';
OTM.OpportunityAccessLevel = 'Read/Write';
listOpptyTeamMem.add(OTM);
if(listOpptyTeamMem.size() > 0)
insert listOpptyTeamMem;
}
}
}
Kindly help me pls
Thanks in advance