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

APEX Code for Owner of Opportunity - AN Urgent Reponse Needed
Dear All,
I've a typical situation on hand - There is frequent change of ownership of opportunities in our Org between Sales & Solutions team and it's imprative for us to track the last time Sales Team had changed the ownership of the opportunity to the Solutions Team.
Appreciate, if someone could please suggest a solution for this problem through a Trigger - A Skeletal apex code to achieve the same would be much appreciated.
Thanks & Regards,
Debendra
I've a typical situation on hand - There is frequent change of ownership of opportunities in our Org between Sales & Solutions team and it's imprative for us to track the last time Sales Team had changed the ownership of the opportunity to the Solutions Team.
Appreciate, if someone could please suggest a solution for this problem through a Trigger - A Skeletal apex code to achieve the same would be much appreciated.
Thanks & Regards,
Debendra
Hi Deb,
Could you please explain the requirement in detail .
Thanks,
Gaurav
skype: gaurav62990
Have you tried setting the "field history tracking" for "Opportunity Owner" field?
It tracks the both Old and New values for that field that changed overtime.
If it Still doesn't satisfy you, Let me know I will try to provide code that suits your requirement.
Hi Deb,
You can use OpportunityHistory Object which maintain the record changes for every opportunity records.
Please go through the Object structure:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunityhistory.htm
Hope this helps!!!
Thanks,
Gaurav
Skype: gaurav62990
As for Storing these values in the record, I believe they are already stored in a Related list, Which you should Add it into your Page Layout ( look for "Opportunity Field History" and place it on the layout.
Let me know if it works
Best,
Nithesh
This Should do the trick. Notice that I have changed the history(list) to map.