You need to sign in to do that
Don't have an account?
Mahurrinah Sims
Approval Process - Ownership Transfer
How would I have an approval process start once someone tries to change ownership of an account record? I know I will need a bit of apex code. Is this possible for a beginner?
Yes this is possible. Create a trigger on the account record for after update, check to ensure that the owners are different once done, create your approval request and submit them. Ensure that you have built an approval request declaritavely that the new records will match first. You may want to set a flag such as Account.submitForApproval (checkbox) that gets set in code when the change is found and unchecked once the approval process is approved or rejected. Here is some quick code to help you out:
Let me know if you have any questions.
Thanks for working with me on this! I have a few questions.
1) This approval process would only be for 4 reps who report to one manager. Is there any way to specify exactly who the approval process to happen for.
2) Can you outline the items in the code that has to be changed by me in order for this to work?
3) Will this code require sandbox testing?
4) Will you be able to walk me through these steps that you outlined here "create your approval request and submit them. Ensure that you have built an approval request declaritavely that the new records will match first. You may want to set a flag such as Account.submitForApproval (checkbox) that gets set in code when the change is found and unchecked once the approval process is approved or rejected."?
Thanks again for your help. I know there are a lot of questions but I am really new at this.
1. Yes this is possible in your approval process. In your criteria you would have something like Owner = Sales Rep 1, Owner = Sales Rep 2, .... Owner.Manager = Manager.
2. You do not need to change any portion of the code for this to work. The code provided just submits a record to the approval processing engine.
3. Yes it will
4. Please review https://help.salesforce.com/HTViewHelpDoc?id=approvals_creating_approval_processes.htm&language=en_US This help file will walk you through creating approval processes.Once you've run through the documentation I would be more than happy to answer further questions.
Tyler
Can you explain the functions that make the trigger work? ie. req.setComments