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

Approval Process works fine when manually submitted but fails when called in a trigger
Hello ,
I have an approval process on custom object where I want 2 related user to be assigned as approvers , I defined the approval step for this and everything works fine when I manually submit a record for approval.
But if I submit the record for approval from a trigger I am getting the error
MANAGER_NOT_DEFINED, Manager undefined
I did not define the ( Next Automated Approver Determined By) since I dont want the manager to approve this , I want only the 2 related users defined in the approval step to be assigned.
Any IDeas?
Thanks

I have an approval process on custom object where I want 2 related user to be assigned as approvers , I defined the approval step for this and everything works fine when I manually submit a record for approval.
But if I submit the record for approval from a trigger I am getting the error
MANAGER_NOT_DEFINED, Manager undefined
I did not define the ( Next Automated Approver Determined By) since I dont want the manager to approve this , I want only the 2 related users defined in the approval step to be assigned.
Any IDeas?
Thanks
There is no such field on my custom object , this field is on the approval process " Next Automated Approver Determined By " , if I set it to manager the submission for approval will work from a trigger. if I leave it empty then I get the error above when submitting from a trigger , but it works fine if I manually submit the record for approval.
In my scenariio , I dont want the manager to approve ! I want the approvers to be assigned fron the first approval step.
Thanks
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yFAIAY
On a given approval step, you might have chosen the "related user" who would approve this record. This would be a lookup field on the object that points to a user. Let's say the field is called "X". When the record enters this approval step and X is empty, you will get MANAGER_NOT_DEFINED error.
The solution is to make sure "X" is always set when you enter this step.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessRequest.htm#apex_ProcessRequest
http://www.shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/