0

We are getting this error:

Insert failed. First exception on row 0; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user

When we are performing insertion trying to update contact or user object where in user is inactive.

Please check below class and help us to avoid the error.

2 Answers 2

2

This is a standard Salesforce functionality to not allow inactive users to create new record in System.

Any reason specific reason why you are trying to insert new record with inactive user.

Activating the user will solve the problem.

2

You can try Database class to insert or update any contact or user record. Insert using following code --

Database.SaveResult[] insertResult = Database.insert(<UserList/ContactList>, false);

Update using following code

Database.SaveResult[] unsertResult = Database.update(<UserList/ContactList>, false);

You can view errors using following code -

for(Database.SaveResult rs : insertResult/unsertResult){
       if(!rs.isSuccess()){
            Database.Error emsg=rs.getErrors()[0]; 
            SYSTEM.DEBUG('--ERRORS--'+emsg);
        }
    }

This will help inseting or updating valid contact or user records. Invalid record can be viewed using the resultset code given above.

2
  • Hi@Pramit Kumar. Thank you for your reply .Can you please tell me Exactly where can i use Database.SaveResult in my code.
    – Vasu
    Commented Apr 18, 2017 at 9:57
  • Database.Savereult is for your own use to see which records get inserted/updated and which records get failed and reason for their failure.
    – user40978
    Commented Apr 18, 2017 at 10:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .