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
Haseeb Ahmad 9Haseeb Ahmad 9 

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

Hello,

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,

Greetings!

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.

Reference:https://developer.salesforce.com/forums/?id=906F00000008oZXIAY

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

Thank you!

Regards,
Shirisha Pathuri
 
Dan Adams 15Dan Adams 15
Companies often have two options when it comes to employing dedicated developers: they can either hire domestically or outsource. Now that outsourcing offers so many evident benefits, it makes sense why so many business owners today are choosing this route. Recruiters that specialize in IT outsourcing typically look for choices that would be both affordable and of excellent quality (more about you can find here https://mobilunity.com/blog/hire-developers-in-lithuania/). At that point, outsourcing to foreign nations looks like a sensible move. One of the most alluring nations for these reasons is Lithuania, which provides a large selection of excellent professionals who charge comparatively modest charges.