Error: Failure Message: "System.DmlException: Insert failed. First exception on row 407; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: ",
We have a really weird situation. Sounds like this may be a Salesforce bug that was introduced recently. What we had working perfectly before (last 2 months), is failing as of this evening.
Created a change set in production this morning. Validated successfully. When trying to deploy the change set this evening, we get:
Failure Message: "System.DmlException: Insert failed. First exception on row 407; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: ",
The line of code that is throwing the error is a inserting a custom object. The owner of the custom object may be an inactive user. From everything I have read, that is allowed.
Also, this used to run just fine before and the exact same code is throwing the exception.
This is only happening when the code is called from a Test Method (v24).
Any ideas what could the cause? Has something changed around how Salesforce enforces inactive users?
I am running a query on the Event object, and it's working until I tried grabbing a custom field on the User who is assigned (the Owner). I already had standard fields pulling from the Owner, so not sure why it's not working for the custom field. I pulled my naming from the schema browser a few different times, just to be sure...
Here's my query:
tempAppts = [SELECT WhoId, WhatId, OwnerId, Owner.FirstName, Owner.Profile__c, Owner.Name, Subject, StartDateTime, Result__c FROM Event WHERE WhoId = :contactID AND StartDateTime >= :yaynow AND Result__c != 'Rescheduled'];
OwnerId, Owner.FirstName, and Owner.Name work fine, but once I put in Owner.Profile__c I get an error on save. I have tried OwnerId.Profile__c, Owner__r.Profile__c, etc. The error message is strange as well, references "Name" instead of "Owner":