function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CW83CW83 

When validating a change set in production I get an "Inactive User" error on a ChatterAnswers class

Here is the error I am getting:

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: []", Failure Stack Trace: "Class.ChatterAnswers.createAccount: line 4, column 1 Class.ChatterAnswersCreateAccountTest.validateAccountCreation: line 10, column 1"

I am stumped.  I was able to validate and deploy from my dev sandbox to my UAT sandbox but now I get this error in production when I go to validate.   

I looked to see if I had any assignment rules that were trying to assign to an inactive user.  I also looked to make sure I didn't have any inactive users that are Chatter Answers users.  

Any ideas?

Best Answer chosen by Admin (Salesforce Developers) 
Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

Yes, it refers all the users. Here in your code try including the condition highlighted.

 

User[] user = [SELECT Id, Firstname, Lastname from User where isActive =: true];

 

This might work. Try this and inform me if there is any problem.

 

Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.

All Answers

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

This error has occured while validating deployment details in Production alone rgt?

 

This seems to be your production environment user is inactive and that user id might be referred in the following controllers as well as test classes.

 

Class.ChatterAnswers.createAccount: line 4

and  

Class.ChatterAnswersCreateAccountTest.validateAccountCreation: line 10

 

Check the line mentioned in the failure message.

 

 

Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.

 

 

CW83CW83

Here is what those two lines say:

 

 User[] user = [SELECT Id, Firstname, Lastname from User];

 

So it seems it does refer to any user.

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

Yes, it refers all the users. Here in your code try including the condition highlighted.

 

User[] user = [SELECT Id, Firstname, Lastname from User where isActive =: true];

 

This might work. Try this and inform me if there is any problem.

 

Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.

This was selected as the best answer
CW83CW83

That was it.  Thank you so much.