function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
phiberoptikphiberoptik 

Custom Object record creation based on static schedule

Scenario: Sales rep must acquire a collection of data from each customer on a monthly basis. Most customers are setup for automatic collection but a subset (defined by a value in a picklist field on the Account record) require a manual extraction. The extraction schedule is a static schedule that all manually extracted customers follow (it changes once per year depending on financial calendar). No matter when an Account becomes a customer, their first manual extraction is due by the next due date on the schedule. So, if an Account becomes a customer on 4/13/2013 and the due dates for extraction are 1/21/13, 2/20/13, 3/22/13, 4/21/13, 5/21/13.... then new extraction records would be created and due on 4/21/13, 5/21/13, etc. through the end of the year.

Basically, if an Account is setup for manual extraction, I need to assess when an extraction is due based on this static schedule. Each extraction requires a set of fields to be completed, so I have extractions setup as a custom object.

 

How can I:

 

1.Dynamically create individual Extraction records related to the Account based on the remaining extractions on the current year's schedule.

 

2. Alert the rep that they need to complete a manual extraction based on the static schedule and thus create an extraction record in Salesforce?

Jeff MayJeff May

You might think about using a Custom Setting to store your "Extraction Dates", then set an Account trigger on insert/update that checks to see if the Account just became a Customer. If so, grab the next "Extraction Date" from the Custom Setting and create an 'Extraction task', or whatever object you are using.  Setting a WF/Email Update on the "Extraction Task" will let you notify the Rep.

phiberoptikphiberoptik

Thanks Jeff, but how would this continue on after the first extraction record was created? This recurs every month.

Jeff MayJeff May

if this logically goes on forever, you could add a similar trigger to the Extraction object and when one is closed, look ahead and make sure the others have been defined based on the Custom Setting.  That way, whenever you add more dates, the next time an Account becomes a Customer, or an Extraction is completed, any missing future Extractions would be scheduled.