Skip to main content
I have a couple places where it would be very helpful to take information logged in a lead and push them to a follow-up task or information logged on an opportunity and create an event.  I'm learning that this isn't possible via a workflow, so I need to use an Apex Trigger.  Could someone help me get started on an Apex trigger that runs when a task or event of a specific type is created that is goes and looks up information related to that task / event?

 

Thank You.
1 respuesta
  1. 2 jun 2010, 18:29
    I recommend contracting a developer or using premier support for help on these as sample syntax still needs test code & issues tend to arise.

     

    The developer boards have a log of sample code such as this example of updating a lead from a task:

     

    http://community.salesforce.com/t5/Apex-Code-Development/Apex-Trigger-Task-log-a-call-updating-Lead-status/m-p/170626

     

    basic logic you need: 

    • Query leads where Lead.Id = Task.WhoId to get the fields you want
    • Loop through tasks & update the desired task field based on the lead fields

    Note you can limit the trigger to only lead tasks by checking if the WhoId starts with '00Q'

0/9000