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

Apex trigger on a Date
Help! I'm new to Saleforce and Apex. I just had something happen in our production and I have no control over it. I need to know how to create a trigger based on a date.
Our company launched a Trial Version of a product, the user fills out the form and the Lead goes into Salesforce. I created a field that adds 'x' days onto the create date and that is the expired date calculated field. The indicator = "Y" and when the expired date is reached I want to change Indicator to "N". All fields (expired date field, and Indicator field) are in Leads.
I don't have time to search all blogs and find the answer. I have never created a trigger before. I created a workflow, but this only seems to work when the record is created or edited, I need something that knows what day it is and then changes the indicator field.
Can anyone help?
Our company launched a Trial Version of a product, the user fills out the form and the Lead goes into Salesforce. I created a field that adds 'x' days onto the create date and that is the expired date calculated field. The indicator = "Y" and when the expired date is reached I want to change Indicator to "N". All fields (expired date field, and Indicator field) are in Leads.
I don't have time to search all blogs and find the answer. I have never created a trigger before. I created a workflow, but this only seems to work when the record is created or edited, I need something that knows what day it is and then changes the indicator field.
Can anyone help?
If so you can build it into that, then "Y" or "N" will display at run time.
A trigger only fires on insert or update.
Is this even possible? If a trigger can only be done at insert or update, this won't work...
Any ideas what will?
The Expire date = 16 days + Create Date. When Today()>=Expire date launch e-mail to user with a certain template...
Thanks!
Message Edited by mikef on 05-20-2008 05:01 PM
You can have an event fire using a static time, like an email.
Look at the add time trigger in workflow rules this might work for you.
Now...when the Indicator goes to 'N' I want an auto-response e-mail to trigger to the e-mail on the Lead. So if Joe Smith signed up for our two-week trial, he gets a lead indicator = "Y" and I have an auto-repsonse that kicks off when the lead is created that sends him an e-mail letting him know we will contact him soon.
Then, in 2 weeks, the indicator (thanks to time trigger) is set to 'N' but I can't figure out how to send an auto-response to the user because the lead field is updated, but I think auto-response only works on creation? Am I correct?/
I was able to do an internal e-mail trigger to let the sales person know that Joe Smith just expired, but I can't figure out a way to auto-send Joe smith an email..
It worked!!! I didn't know you could choose the lead field, that is exactly what I was looking for.
Thanks!!:smileyhappy: