You need to sign in to do that
Don't have an account?
Rahul Sangwan7341
System.DmlException: Process failed. First exception on row 0; first error: MANAGER_NOT_DEFINED, Manager undefined.: []
u=[Select Id,ManagerId from User where UserName='abc@gmail.com']; System.debug('.....User...........'+u+'........'+u.ManagerId); List<Credit_Enhancement__c> creditList=creditListTestData(); creditList[0].OwnerId=u.Id; test.startTest(); insert creditList; creditList[0].DummySentForApproval__c=true; creditList[0].DummyApprovedCB__c=true; System.runAs(u){ Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval.'); req1.setObjectId(creditList[0].id); req1.setSubmitterId(u.Id); Approval.ProcessResult result = Approval.process(req1); } update creditList;
The user record does not have managerId. The Query at line no 1 - for the user u the manager id field is null so you are getting this error.
Solution:-
Create another test user and assign that test user as the manager for the user u.
Thanks,
Saraz