You need to sign in to do that
Don't have an account?
saad mechiche alami
Trigger field is not Writeable
hello everyone;
In the code below I am trying to put a contract owner in the opportunity team record and i want to grand him read/write permission in that record
My issue is that when i try to save that record, I get an error message saying
Error: Compile Error: Field is not writeable: OpportunityTeamMember.OpportunityAccessLevel at line 27 column 1
can you please help, many thanks
In the code below I am trying to put a contract owner in the opportunity team record and i want to grand him read/write permission in that record
My issue is that when i try to save that record, I get an error message saying
Error: Compile Error: Field is not writeable: OpportunityTeamMember.OpportunityAccessLevel at line 27 column 1
can you please help, many thanks
trigger OpportunityBeforeUpdate1 on Opportunity (before update) { string oppName; opportunity oppId; SVMXC__Service_Contract__c smc= new SVMXC__Service_Contract__c(); for (opportunity opp: trigger.new) oppName=opp.name; oppId=[select Id, name from opportunity where name=:oppname limit 1]; integer res=oppName.indexof(' - '); String ConName=oppName.left(res); smc=[select name, OwnerId from SVMXC__Service_Contract__c where name=:ConName limit 1]; OpportunityTeamMember oppt = new OpportunityTeamMember(); oppt.OpportunityId=oppId.Id; oppt.userid=smc.ownerid; oppt.OpportunityAccessLevel='edit'; oppt.TeamMemberRole='Service Sales Contributor'; insert oppt; }
I have rewritten the trigger as below: Note: update the code to handle the bulk records.
Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.
All Answers
You need to add the team members to the opportunity and then update the sharing access to the opportunity for these users.
Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.
I have updated the code using your part as posted below, I have 2 questions
1/when I try to put opp.id in the code (see bold line in the code)
member.OpportunityId = opp.Id;
it is not working and I get the error:
Variable does not exist: opp.Id
that's why I am putting the query : oppId=[select Id, name from opportunity where name=:oppname limit 1];
is there a way to get the ID of the current oppotunity (in each iteration of the for loop)
2/ the user inserted in the opportunity team in my code is still having read only in the Opportunity Access
while in the code:
share.OpportunityAccessLevel = 'Edit'
Code:
I have rewritten the trigger as below: Note: update the code to handle the bulk records.
Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.