+ Start a Discussion

Trigger help?


I was wondering if someone would be kind enough to help me. 

I am looking for a trigger to pull into a custom object the amount for a closed won opportunity based on a user lookup field filled with their name. 

So if User Joe Bloggs has closed won £ this month, list the opportunities in the custom object called targets, so I can roll up the total amount of opportunities and compare it to a field that has a sales target. 

I dont write code unfortunatley but willing to learn. 

Your help or advice is very much appreciated in advance. 

Ruwantha  LankathilakaRuwantha Lankathilaka
First try to write the code. Then post your findings / what you tried. Then people will guid you.
Will try. Gonna tackle the trailhead and see where that leads. I did modify a trigger and it works. 

I'll keep you posted


If you could share details around the specific object names and how the functionality is expected to behave, and I can help you write the Apex Trigger. Moreover, if you want to learn to code with Apex, start with Quick Start with Apex (https://trailhead.salesforce.com/projects/quickstart-apex) Module on Trailhead and work your way through the Advanced and Intermdiate modules as you get comfortable.

If you specifically, need to understand how to implement an Apex trigger, this Getting Started with Triggers (https://trailhead.salesforce.com/modules/apex_triggers) trailhead should help you get going.

Another great reference for Apex is the Apex Devloper Guide (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm) which is an exhaustive reference. Try referring this once you are done with the beginner modules on Trailhead so as to avoid getting overwhelmed.

Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.