You need to sign in to do that
Don't have an account?

Insert failed. First exception on row 12; first error: INVALID_CROSS_REFERENCE_KEY, Owner ID:
Hi,
i have a class that i run from system log screen ervery month. it was working fine but all of a suddon it has started giving errors as below.
*********************************** Error Log******************************
Apex script unhandled exception by user/organization: 00520000001grzo/00D20000000BaRL
Failed to process batch for class 'clsInvoiceRun' for job id '7072000000AspWh'
caused by: System.DmlException: Insert failed. First exception on row 12; first error: INVALID_CROSS_REFERENCE_KEY, Owner ID: owner cannot be blank: [OwnerId]
Class.clsInvoiceRun.execute: line 180, column 9
External entry point
Debug Log:
6 (476287000)|SYSTEM_METHOD_ENTRY|[163]|MAP.containsKey(ANY)
14:53:05.476 (476365000)|SYSTEM_METHOD_EXIT|[163]|MAP.containsKey(ANY)
14:53:05.476 (476400000)|STATEMENT_EXECUTE|[163]
14:53:05.476 (476458000)|VARIABLE_ASSIGNMENT|[161]|i|103
14:53:05.476
.
.
.long list continue.....
.
.
14:53:05.818 (818405000)|WF_RULE_FILTER|[Invoice : Invoice Status equals Finance Approved]
AND [Invoice : Record Type equals Invoice Stage 2]
14:53:05.818 (818527000)|WF_RULE_EVAL_VALUE|1
14:53:05.818 (818595000)|WF_CRITERIA_END|false
14:53:05.818 (818681000)|WF_SPOOL_ACTION_BEGIN|Workflow
14:53:05.818 (818828000)|WF_ACTION| None
14:53:05.818 (818897000)|WF_RULE_EVAL_BEGIN|Escalation
14:53:05.818 (818960000)|WF_RULE_EVAL_END
14:53:05.819 (819194000)|WF_ACTIONS_END| None
14:53:05.819 (819278000)|CODE_UNIT_FINISHED|Workflow:01I20000000cVKI
14:53:05.820 (820086000)|DML_END|[180]
any help will be appriciated
thanks,
This query on line 154:
appears to be returning a blank value in your Donor__r.IRP_Country__r.Primary_PO_User__c field for one of the records returned.
All Answers
Would need to see the code being executed.
below is the code, i invoke this class from system log -> execute Database.executeBatch(new clsInvoiceRun());
thanks,
This query on line 154:
appears to be returning a blank value in your Donor__r.IRP_Country__r.Primary_PO_User__c field for one of the records returned.
Thanks Ryan, you definitely saved my many hours. You are a STAR