+ Start a Discussion

Deployment Error " Entity is not org-accessible" on Account Trigger

Hi All,


I have created a trigger on account, when mergae two accounts then lossing account owner will be the part of account team. I have tested this trigger on sandbox and everythng is working fine.


Now i am deploying this trigger on production then it is showing error "Entity is not org-accessible". Please help me.


Trigger Code is:


trigger AccountMerge on Account (after delete) {
TriggerEnabled__c myCS = TriggerEnabled__c.getValues('AccountMerge');
if(myCS==Null || (myCS.Object_Name__c=='Account' && myCS.Active__c==True)){
List<AccountTeamMember> lstAccountTeam = New List<AccountTeamMember>();
List<AccountShare> acctSharingRules = new List<AccountShare>();
Map<id, Account> mapAccount= New Map<Id, Account>();
Map<string,AccountTeamMember> mapAccountTeam = New Map<string,AccountTeamMember>();
List<Id> lstAccountID= new List<Id>();

for(Account objAccount: trigger.old)

for(Account objAccount: [Select id, Ownerid, Name from Account where id =:lstAccountId])
mapAccount.put(objAccount.Id, objAccount);

for(Account objAccount: trigger.old)
if(objAccount.MasterRecordId!=Null && mapAccount.get(objAccount.MasterRecordId).OwnerId!=objAccount.OwnerId){

string strTemp= objAccount.MasterRecordId + '-' + objAccount.Ownerid;
AccountTeamMember objAccountTeam = new AccountTeamMember();
objAccountTeam.AccountId = objAccount.MasterRecordId;
objAccountTeam.TeamMemberRole = 'Sales Rep';
objAccountTeam.UserId = objAccount.ownerid;
mapAccountTeam.put(objAccount.MasterRecordId + '-' + objAccount.ownerid,objAccountTeam );

AccountShare processorSharingRule = new AccountShare();
processorSharingRule.AccountId = objAccount.MasterRecordId;
processorSharingRule.OpportunityAccessLevel = 'Edit';
processorSharingRule.CaseAccessLevel = 'Edit';
processorSharingRule.AccountAccessLevel = 'Edit';
processorSharingRule.UserOrGroupId = objAccount.ownerid;
system.debug('Account Team---->' + lstAccountTeam);
//system.debug('acctSharingRules------>' + acctSharingRules);
try {
insert lstAccountTeam;
insert acctSharingRules;
catch (System.DmlException e){





Thanks for your reply.

I have checked all the solution, but still i am facing this problem

Hi Atul111,

Check if Account Teams is enabled in your Production Org.

Customize --> Account --> Account Teams

Once this is enabled it should work!

The AccountTeamMember is not accessible unless you enable it here.