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
Atul111Atul111 

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)
if(objAccount.MasterRecordId!=Null)
lstAccountId.add(objAccount.MasterRecordId);

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;
if(!mapAccountTeam.containsKey(strTemp)){
AccountTeamMember objAccountTeam = new AccountTeamMember();
objAccountTeam.AccountId = objAccount.MasterRecordId;
objAccountTeam.TeamMemberRole = 'Sales Rep';
objAccountTeam.UserId = objAccount.ownerid;
lstAccountTeam.add(objAccountTeam);
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;
acctSharingRules.add(processorSharingRule);
}
}
}
system.debug('Account Team---->' + lstAccountTeam);
//system.debug('acctSharingRules------>' + acctSharingRules);
try {
if(lstAccountTeam.size()>0)
insert lstAccountTeam;
if(acctSharingRules.size()>0)
insert acctSharingRules;
}
catch (System.DmlException e){
}
}
}

====================================================================

 

 

Atul111Atul111

Thanks for your reply.

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

SuriSuri
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.

Suri