Link to home
Start Free TrialLog in
Avatar of joedfuse
joedfuseFlag for United States of America

asked on

Help with an APEX trigger that creates events based on a custom datefield for every 30 days for a year

Hello community,

Im fairly new to apex in salesforce.com and would greatly appreciate some help writting a trigger that will take a custom date field in the contact object and create follow up calendar entries every 30 days for a year.

For example ....

We have a field in the contact object called intakeDate this may be different that the actual date the contact was created. I would like the trigger to add 30 days to the date check if an event was already added and if not create the event in the owners calendar. Then add 60 days and do the same thing and 90 , 120 , 180 etc... all the way to a year.

I dont really know where to begin on this so any help or direction would be appreciated.

Thanks a ton in advance for any guidence on this.
Avatar of techhealth
techhealth
Flag of United States of America image

Everything you need to know to start Apex programming is here:
http://www.salesforce.com/us/developer/docs/apexcode/index.htm

In your particular situation, you'll need to know how triggers work, and the type needed would be an after insert and/or an after update trigger.  The logic would be creating new Events, so you'll need to get familiar with the Event object, particularly how they're linked to Contacts (through WhoId field).  If you need to check for existing Events, then you'll need query for existing Events for the Contact using SOQL.

Avatar of joedfuse

ASKER

Im currently in the apex 531 class now so im getting a basic understanding. I just wasnt sure what to look for in the class to accomplish this

thanks
Do you know where i can get a very basic code sample to get me started. Obviously i don't expect anyone to do my work for me but it would be helpful to see something i can work from to figure it out

thanks
ASKER CERTIFIED SOLUTION
Avatar of techhealth
techhealth
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great thanks for the head start now i know where to look
Glad to help!