• ess
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record:

 

I am getting the above error message when I am trying to load data through the data loader but in case of UI  I am not having the issue.

 

I have a trigger on after insert of lead which is trying to update records leads and on that line this error is occuring.

Message Edited by ess on 08-25-2009 06:43 AM
  • August 25, 2009
  • Like
  • 0
I have created a report that I can export to excel but it is just exported in text format. Is there  any add on that can be bought that allows you to export in a formatted way
  • August 20, 2009
  • Like
  • 0
I have about 10  record types of case. I want a user to access the case object through customer portal. The user should be able to select the record type . But in the self service portal I am unable to do so. Please suggest a solution. I don`t want to use customer portal.
  • July 16, 2009
  • Like
  • 0

To auto populate the standard employee number field on user object I have created auto no field and using a trigger on object user on after insert I am updating also . Also as per my requirement I have to also create a contact record on the after insert of user . But is not allowing me to do both the dml operation together.

 

the code is as follows:

trigger employeenoautopopulate on User (after insert)
{
 
     List<Contact> Con = new List<Contact>();
 
     for(User usr: Trigger.new)
     {
             System.debug('****** condition true');
             Contact con_temp = new Contact();
             con_temp.FirstName = usr.FirstName;
             con_temp.LastName = usr.LastName;
             con_temp.Date_Of_Joining__c = usr.Date_of_Joining__c;
             con_temp.User__c = usr.Id;
             con_temp.OwnerId = usr.Id;
             con_temp.Employee_Number__c = usr.Employee_Number__c;
             Con.add(con_temp);
      }  
      if(Con.size()>0)
      {
       insert Con;
        System.debug('****** insert done');
      }
   
     Set<Id> userid = new Set<Id>();
     for(User usr: Trigger.new)
     {
  
         userid.add(usr.Id);   
     }
  
     User[] usr = [select Id, EmployeeNumber,Employee_Number__c from user where Id in :userid];
     for(Integer i=0;i<usr.size();i++)
     {
        usr[i].EmployeeNumber = usr[i].Employee_Number__c ;
        System.debug('****'+usr[i].Employee_Number__c);
     }
      
      update usr;
      System.debug('****** update done');
}

 

I am getting following exception:

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger employeenoautopopulate caused an unexpected exception, contact your administrator: employeenoautopopulate: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User: []: Trigger.employeenoautopopulate: line 20, column 8
 

 

  • June 18, 2009
  • Like
  • 0

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record:

 

I am getting the above error message when I am trying to load data through the data loader but in case of UI  I am not having the issue.

 

I have a trigger on after insert of lead which is trying to update records leads and on that line this error is occuring.

Message Edited by ess on 08-25-2009 06:43 AM
  • August 25, 2009
  • Like
  • 0

To auto populate the standard employee number field on user object I have created auto no field and using a trigger on object user on after insert I am updating also . Also as per my requirement I have to also create a contact record on the after insert of user . But is not allowing me to do both the dml operation together.

 

the code is as follows:

trigger employeenoautopopulate on User (after insert)
{
 
     List<Contact> Con = new List<Contact>();
 
     for(User usr: Trigger.new)
     {
             System.debug('****** condition true');
             Contact con_temp = new Contact();
             con_temp.FirstName = usr.FirstName;
             con_temp.LastName = usr.LastName;
             con_temp.Date_Of_Joining__c = usr.Date_of_Joining__c;
             con_temp.User__c = usr.Id;
             con_temp.OwnerId = usr.Id;
             con_temp.Employee_Number__c = usr.Employee_Number__c;
             Con.add(con_temp);
      }  
      if(Con.size()>0)
      {
       insert Con;
        System.debug('****** insert done');
      }
   
     Set<Id> userid = new Set<Id>();
     for(User usr: Trigger.new)
     {
  
         userid.add(usr.Id);   
     }
  
     User[] usr = [select Id, EmployeeNumber,Employee_Number__c from user where Id in :userid];
     for(Integer i=0;i<usr.size();i++)
     {
        usr[i].EmployeeNumber = usr[i].Employee_Number__c ;
        System.debug('****'+usr[i].Employee_Number__c);
     }
      
      update usr;
      System.debug('****** update done');
}

 

I am getting following exception:

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger employeenoautopopulate caused an unexpected exception, contact your administrator: employeenoautopopulate: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User: []: Trigger.employeenoautopopulate: line 20, column 8
 

 

  • June 18, 2009
  • Like
  • 0