You need to sign in to do that
Don't have an account?
Entity is not org-accessible at line 1 column 1
hi could u give the soluti
trigger salesContacts on Opportunity (after insert){
List<OpportunityShare> sharesToCreate = new List<OpportunityShare>();
List<OpportunityTeamMember> oppteam = new List<OpportunityTeamMember> ();
if(trigger.new[0].Partner_User__c != null) {
OpportunityShare oshare = new OpportunityShare();
oshare.OpportunityAccessLevel = 'Edit';
oshare.OpportunityId = trigger.new[0].Id;
oshare.UserOrGroupId = trigger.new[0].Partner_User__c;
sharesToCreate.add(oshare);
OpportunityTeamMember ot = new OpportunityTeamMember();
ot.OpportunityId = trigger.new[0].Id;
ot.UserId = trigger.new[0].Partner_User__c;
ot.TeamMemberRole = 'Reseller';
oppteam.add(ot);
}
// do the DML to create shares
if (!sharesToCreate.isEmpty())
insert sharesToCreate;
// do the DML to create shares
if (!oppteam.isEmpty())
insert oppteam;
}
on for above error given the code below
The error is self explanatory you don't have any field called Partner_User__c on Opportunity object.Please go tto Setup and see the API name of the field you want to use and replace this with the correct name.
All Answers
The error is baecause of one of the follwing reasosn.
1.) You don't have OpportunityTeams enabled in your org.
2.) Your Opportunity sharing OWD settings is neither Public Read Only nor Private
thank you for giving the reply , i did that change but error came
Error: Compile Error: Invalid field Partner_User__c for SObject Opportunity at line 9 column
The error is self explanatory you don't have any field called Partner_User__c on Opportunity object.Please go tto Setup and see the API name of the field you want to use and replace this with the correct name.
Thank you it was successfully executed
Error: Compile Error: Entity is not org-accessible at line 1 column 1
scenario :trigger adds the opportunity owner into the sales team automatically when opportunity is created
trigger oppteam on opportunity(after insert)
{
list<opportunityteammember> oppteam=new list<opportunityteammember>();
opportunityteammember ot=new opportunityteammember();
ot.opportunityid=trigger.new[0].id;
ot.userid=trigger.new[0].ownerid;
ot.teammemberrole='accountmanager';
oppteam.add(ot);
if(oppteam!=null&&oppteam.size()>0)
{
insert oppteam;
}
}