+ Start a Discussion
lleachlleach 

Querying and emailing reminders for opportunituies

Hello,

 

I am new to salesforce and am currently browseing through the large number of tutorials here.

 

However, I was hoping someone could give me some pointers to help me resolve an immediate issue.

 

I have seen this issue raised elesewhere in the message boards, but there did not appear to be a clear resolution.

 

An email authentication rule was created to automatically send a reminder out when an opportunity 'expires', i.e., when a created field 'registration expires' becomes less than todays date.

 

Although this works fine for subsequently edited or created opportunities, and which were created BEFORE the rule and have not been edited since do not appear to trigger.

 

I have read from This Thread that this is because email rules do not apply retroactively to records, and only become 'linked' to the opportunity if is created or edited after the rule is created.

 

Unfortunatly, there appears to be a large number of opportunitues which are now not sending out reminder emails, far to many to go through and edit manually.

 

What I was hoping I could get help with is a way to query all the opportunitues and send out a template email to each that has exipired.

 

However, I have no idea where to start, or what terms to search for in the help.  Is this an S-Control, raw apex code or is there a way to mass edit/save the records to trigger the remider? How do I query the opportunties? Some sort of query then a 'foreach' loop maybe?

 

Many thanks,

 

Laurence

NikiVNikiV

If you have set up a time-based workflow that triggers on certain criteria, you need to trigger the workflow on Opportunities that meet the criteria but the Last Modified Date is before the date you activated your workflow.  If you can export those Opportunities to a csv file with the Opp Id, the Data Loader can be used.  Here is the wording from SFDC Help:

 

 

SETUP: You have an active Workflow Rule for an object that works great every time you edit a record. QUESTION: How to trigger this Workflow Rule for a large number of records in this object that don't need to be edited. - PROBLEM 1: These records don't need anything updated, don't need an "Edit". - PROBLEM 2: Don't want to have to click through "Edit" session manually for each separate record. SOLUTION: Data Loader can be used to trigger a large group of records. STEP 1 - Data Loader Export: 1) Start up Data Loader and log in using your salesforce.com username and password, click Login, click Next. 2) Select function "Export" and choose an XLS file (and folder) to store results in. 3) Object: Choose which object you're working with, the object with the Workflow Rule(s). - Fields: Id (optionally other fields if you need to view manually). - You can selectively choose particular records using SOQL query, or just select all records in this object. 4) Complete the Data Loader steps to export those records into the XLS file. Optionally peruse that XLS file and remove any records that you want to exclude. STEP 2 - Data Loader Update: 1) In Data Loader, select function "Update" - this is equivalent to "Edit" in salesforce.com GUI. 2) Use the XLS file that you created/edited above. 3) Object: Same object as above. 4) Field mapping - Important: Just map Id to Id, do not include any other fields NOTE: Id is never updated/modified; is just used to identify each record - all other field mappings WILL UPDATE/MODIFY THOSE FIELDS, and in our scenario here we don't need or want to do this. 5) Complete the Data Loader steps to perform the update. No record data will be changed because we didn't map any fields except Id to specify included records. But all these included records will be "touched" as if edited, thereby triggering that object's Workflow Rule(s). NOTE: Workflow Rules will NOT be triggered if "When record created only" or other criteria exempts an Account record from the rule. If you don't have Data Loader yet, you can download the latest version in salesforce.com at Setup | Data Management | Data Loader