+ Start a Discussion
AxxxVAxxxV 

Unable to deploy trigger "DML not allowed on CampaignShare"

I have the following trigger which runs fine in the sandbox. However, when I attempt to deploy into production org, I receive the following message:

 

"DML not allowed on CampaignShare". 

 

It apears that for simne reason deleting CampaignShare records inproduction is not allowe, while is ok in the sandbox.

 

Both orgs are Spring '09 release.

 

Any help appreciated.

 

 

 

 

trigger CM_T20_SoftDeleteCampaign on Campaign (after update) {
deleteCampaignShare(Trigger.new);

private void deleteCampaignShare(Campaign[] campArr) {

Id softDeleteOwnerId = ConfigurationHelper.SOFT_DELETE_OWNER_USER.Id;

Set<ID> setCampaignIds = new Set<ID>();
for(Campaign campObj :campArr){
if(campObj.Soft_Delete_Pending__c == true) {
setCampaignIds.add(campObj.Id);
}
}

// check array size > 0 before calling update / delete
Campaign[] CampaignLst = [select Id, Soft_Deleted__c, Soft_Delete_Pending__c from Campaign where Id in :setCampaignIds];
if(CampaignLst != null && CampaignLst.size() > 0) {
for(Campaign campObj :CampaignLst)
{
campObj.Soft_Deleted__c = true;
campObj.Soft_Delete_Pending__c = false;
campObj.OwnerId = softDeleteOwnerId;
}
update CampaignLst;
}

CampaignShare[] lstCampShare = [select Id From CampaignShare where CampaignId in :setCampaignIds and RowCause = 'Manual'];
if(lstCampShare != null && lstCampShare.size() > 0)
delete lstCampShare;
}

}

 

 

 

Message Edited by AxxxV on 02-16-2009 11:04 PM
jobojobo

any answer yet? i'm facing the same with EmailMessage.

will salesforce make exceptions? i will open a ticket - not updatable tables? nah!

we are not in salesforce prison here , are we?