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

Trigger on an Account inactivity
Hey guys,
I need some suggestions on how to write a trigger for this particular criteria.
Scenario is like this: An Account is created.And there is No activity on the account for 3 weeks. (no update, or delete).
I need to write a trigger for this inactivity, on Account. I am stumped because until and unless there is some action on account, my trigger wont get fired.
so i need some suggestions on how to move forward with this.
You could use time-based workflow to update a field on the account, which would fire a trigger that creates a case. Another option would be running periodic jobs (See Apex scheduler documentation here - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm) that identify inactive accounts using a SOQL and act upon them.
All Answers
What is the use case... it sounds like you want to use a time-based workflow.
time tirigger would be 21 days after last modified date.
Kyle,
Sorry, i dint explain the scenario properly. So its like this: if there is no activity on the account for 3 weeks, then i need to create a case.
I dont think i can use time-based workflow to create the case.
Any other suggestions please.
You could use time-based workflow to update a field on the account, which would fire a trigger that creates a case. Another option would be running periodic jobs (See Apex scheduler documentation here - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm) that identify inactive accounts using a SOQL and act upon them.
Thank you for the suggestion.
The time-dependent workflow updates a filed in my account object. And that inturn fires the trigger to create the case.
Qucik question though: Any suggestions on using the Batch Apex trigger for the trigger which creates the case. (based on this scenario).