+ Start a Discussion


I am receiving this error from a  trigger code for lead object, When attempting to do a lead conversion.
"execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id"
Failed while -->  inserting campaignMembers.
(Note: campain member creation requires 2 ids --> new CampaignMember(leadid=leadID,campaignid=leadID))
I am confused as why this error is happening only while doing -- lead conversion
And not when-->a) Doing unit testing of trigger using Apex classes
                           b) Sending a bunch of leads from an external application for testing.
I was logged in always as the user that I had tested succesfully the trigger code.
Also, I believe that I have All required permissions.
Any suggestions to resolve?
new CampaignMember(leadid=leadID,campaignid=leadID))

You're not putting in a lead ID where you're supposed to be putting a campaign ID, are you?  That might cause this issue.

No I am not. Sorry, that was a typo in in earlier log.  (as I said, it is working fine while testing and with a batch leads sent).

Any clues?



Well, ok, that would have been too easy.  What do you see when you turn on the debug log and convert a lead?  That might hold a clue.
I'm running into the same issue here:


I think it may be a bug as this type of error is something you receive when a user does not have permissions to update a record, common in s-controls, but since apex should be running in system mode I do not believe you/we should have this problem.

Message Edited by TehNrd on 05-17-2008 10:26 PM
I'm actually experiencing this in several places and have opened a support case. I will report back when I find something out.

It's looking like these are bugs. I have been working with support and they have identified some issues. I would log a case if you can.

I don't believe Apex should ever receive these types of permission errors as it is supposed to execute in "system mode". The only time I can see these types of errors happening is when you have declared the "with sharing" keywords a class.



Is anyone able to solve it? I am also getting the same error message.


Your help is highly  appreciable.




I don't suppose anyone has confirmed if this is still a known issue?


I am running a custom leadconvert and running into this error when the users tries to assign the new Account record (to someone else) at the time of convert.


However, the same user is able to assign his existing Account records to other users without any errors.