+ Start a Discussion
Haseeb Ahmad 9Haseeb Ahmad 9 

Process builder Failed: INVALID_CROSS_REFERENCE_KEY: Owner ID: owner cannot be blank.


We've used Process Builder to set up a process that copies the owner ID from the Account and to the owner of an opportunity. Normally it works perfectly and we don't have any issues. We've set up some APEX code and are running test classes that are failing because of the process. The code creates a new account and opportunity which meets the criteria of the process but we're still getting this error: INVALID_CROSS_REFERENCE_KEY: Owner ID: owner cannot be blank.

Doesn't the owner auto set to be the user creating the account/running the test class? Is there something we need to include in the class in regards to the account owner? 
ShirishaShirisha (Salesforce Developers) 
Hi Haseeb,


This error occurs,if the Owner Id is set to wrong userId or null.Otherwise,when we try to access before the record gets created as CreatedById will be set once the record inserted.

I would suggest you to capture the debug logs and check the code as it will be related to the code you have written.


Please mark it as best answer if it helps you to fix the issue.

Thank you!

Shirisha Pathuri