• Jim_morrison
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 12
    Replies
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?
I am unable to code easily, the following logic.
 
--> Query the batch of Leads to find if the campaign member already exists for them 
--->  If it does not exist, Create One.
 
The issue i see is that: The SOQL select in a for loop, returns only selected rows. If we want to work on those "not matched" I cannot utilize that result.
Ex1: (does not work)
Code:
for(campaign c : [select id from campaign where id in : leadIdList]){
 if c[i].id == null)
  // Do some action such as create a campaign member record.
 i++;
}

Even if you use another coding logic as below, It does not work. since it crosses the SOQL (governers limit) for leads
Ex2: (does notwork)
Code:
for(Lead ld: Trigger.new){ 
   if([select count() from Campaign where id in: leadidList] <= 0){
   //Do some action such as create a campaign member record and store in a list
   }
}
//Then insert all newly created campaign member records at once.
insert xxxx;

 
I bet there is a solution, that I am unable to use here.
 
Thanks in advance.
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?
Hi,
I am getting the following error when I try to deploy my code from dv to test environment:
'Request timed out, check max poll and poll wait millis attributes'
does anyone know what this means?
thanks


Message Edited by Nadia on 05-15-2008 01:16 PM
  • May 15, 2008
  • Like
  • 0
    I have a list defined as List<Map<ID, MyObject__c>> and I am populating multiple maps of these objects into the list as separate entries in the list.
That all appears to work OK.

I am trying to access the records inside the maps inside the list and am running into problems:

It doesn't matter which way I seem to write the inner for loop, I get one error or another on the inner loop -

for(Integer i = counter; i == 0; i--) {
    for(MyObject__c person:peopleList[i]) {
       //do stuff with person
    }
}

or

for(Integer i = counter; i == 0; i--) {
    Map<ID, MyObject__c> p = (Map<ID, PNP_Person__c>)peopleList[i];
    for(MyObject__c person:p) {
       //do stuff with person
    }
}


How do I reference the internal map in the list here?

The error message given here is "Initial term of field expression must be a concrete SObject: LIST:MAP:Id,SOBJECT:MyObject__c "


Thanks in advance for any assistance!
Hi,

       I want to know  about invoking Data Loader from Apex.

Is there any API in Apex Language to invoke Data Loader in Salesforce.com itself  rather than  at  client machine.


Any hints will be helpful...

Thanks in advance.

HI All,

Im am wondering, how does salesforce handle triggers?

Im definitely sure that when a mass update occurs and a trigger on the object exist then it will handle bulk update on the trigger so trigger.new may vary depending on the number of records updated using the mass update.

However, for example two users updates the same record at the same time... how does salesforce handle it on a trigger? will there going to be to trigger context for each user? or will there be only one trigger?

Thanks
I am unable to code easily, the following logic.
 
--> Query the batch of Leads to find if the campaign member already exists for them 
--->  If it does not exist, Create One.
 
The issue i see is that: The SOQL select in a for loop, returns only selected rows. If we want to work on those "not matched" I cannot utilize that result.
Ex1: (does not work)
Code:
for(campaign c : [select id from campaign where id in : leadIdList]){
 if c[i].id == null)
  // Do some action such as create a campaign member record.
 i++;
}

Even if you use another coding logic as below, It does not work. since it crosses the SOQL (governers limit) for leads
Ex2: (does notwork)
Code:
for(Lead ld: Trigger.new){ 
   if([select count() from Campaign where id in: leadidList] <= 0){
   //Do some action such as create a campaign member record and store in a list
   }
}
//Then insert all newly created campaign member records at once.
insert xxxx;

 
I bet there is a solution, that I am unable to use here.
 
Thanks in advance.