+ Start a Discussion
Jim_morrisonJim_morrison 

Trigger code Error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

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?
werewolfwerewolf
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.
Jim_morrisonJim_morrison

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?

 

 

werewolfwerewolf
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.
TehNrdTehNrd
I'm running into the same issue here:

http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=4597#M4597

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
TehNrdTehNrd
I'm actually experiencing this in several places and have opened a support case. I will report back when I find something out.

http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=4678&jump=true#M4678
TehNrdTehNrd
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.
vickvick

Hi,

 

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

 

Your help is highly  appreciable.

 

Thanks

kevinvw2000kevinvw2000

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.

 

Thanks,

 

Kevin.