• jcalfee
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

We need to implement a simple case tracking system using Salesforce. The cases are updated by non-Salesforce users. There are several routes to accomplish this, however, in every case there is an important piece of the puzzle is missing.



In Setup - Case - Email-to-Case there is a column called "Email Services Address." You can send email to Salesforce using computer-assigned e-mail address in that column. So, instead of using the Email-to-Case agent to poll your own email accounts, you can send them directly to Salesforce now. This used in every scenario below.



For proper automation, there are to things to consider: routing and tracking



  1. Route the messages “from” Salesforce to the user will reply “to” Salesforce

  2. Track the case email and responses



When sending a new email from a case, Salesforce inserts a string that looks like [ ref:00DSDITt.500ShQ5G:ref ] in the subject and body. You can't see this, but this is the Case.Thread_Id value. It may not be documented but you can use this value in e-mail templates to provide tracking for responses. You can use this feature when sending emails other ways (from work flow for example. Just include the Case.Thread_Id in the e-mail template.



With the presents of the Thread_Id, all of the sudden, responses with this ID sent to email-to-case will get filed properly. You may have to look for the response though. Open the case, move down to activity history, click on the email, read the top where it says “Click here to view the associated Email Message”. With some basic training anyone can make this work.



Auto-Response (least complicated)

  1. Create an email template contain {!Case.Thread_Id}. In this case, is not added by default.

  2. Create a setup – case – auto-response rule setting the “from” with the Salesforce email address assigned in the email-to-case above. Assign the template you created above.

This almost solves both problems (routing and tracking). The problem is in the very beginning of the routing. The auto-response rule does not allow you to set the “To.” Only the user that created the case gets the email. There is no way to deliver the email to the intended recipients. The Case Support Settings are generic and will not solve the problem either. You can't simply forward the email either because the recipient will reply sending the message back to you and not the case.



Work-Flow (more steps)

In setup – create – work flow, setup the rule and email alert to send to an additional (up to 5) email address. Here you can use the Sandbox to put your own e-mail there. Again, use the e-mail template with the {!Case.Thread_Id} in it. Now the “To” can be set (forget about using CC until this is fixed except now “From” is a problem. The From is the case creator or even worse a no-reply address from Salesforce (see case support setting). This breaks the loop and email-to-case will not receive any replies.

Work flows are flexible, so Salesforce should add the ability to define CC and From fields here. That enhancement should give the biggest bang for the buck.

 

This is my post, it address the CC, BCC, and the From / Reply-To. Please comment and promote, but come back, I'm not through:

 

   http://ideas.salesforce.com/article/show/10092421 (new window)

APEX (even more steps)

The Sandbox allows the creation of a trigger. No need for external programs now to create and update the code ;-) ... This falls short in two way parts:

  1. You can only set reply-to, you can't set “from” .. Reply-to can be ignored by mail clients.

  2. Case.Thread_Id is not available

  3. Email templates tied to cases are not implemented

There is a nice editor now that allows you to create and update apex code without external programs. It is only available in the Sandbox. With this we can trigger and send an email in a new case trigger.

  1. You can set the reply-to but you can't set the from. It is still common that e-mail clients ignore the reply-to and sent the reply to the “from” address. This can break the loop at the worst possible time (when your not looking). I don't like this at all.

  2. Yes, we can set the TO – fantastic

  3. No, can not use a template with Case.Thread_Id because the required target object must be “Only Users, Contact or Lead allowed for targetObjectId”"

  4. Salesforce does not detect and replace the field in the message either:
    mail.setPlainTextBody('RxStrategies does not recognize this transaction. ' + '{!Case.Thread_Id}.');



Hi,

I am having problems with the CLI on Apex Data Loader 14.0. In general, I can get it to work but there are certain issues. I have no problem with Insert and Update but I cannot get Upsert to work properly when it has to do an Insert nor can I get Extract to work properly. The Upsert problem is not so critical as I can always do Insert and Update separately but Extract is critical.

The following is the CLI output from running this batch file:

Batch file:

@echo off
c:
cd C:\Program Files\salesforce.com\Apex Data Loader 14.0\bin
process ..\conf accountExtract


Output file (login info deleted):

2009-01-16 12:47:23,912 INFO [main] controller.Controller initLog (Controller.java:388) - The log has been initialized
2009-01-16 12:47:23,922 INFO [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:78) - Loading process configuration from config file: C:\Program Files\salesforce.com\Apex Data Loader 14.0\bin\..\conf\process-conf.xml
2009-01-16 12:47:23,972 INFO [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:163) - Loading XML bean definitions from file [C:\Program Files\salesforce.com\Apex Data Loader 14.0\bin\..\conf\process-conf.xml]
2009-01-16 12:47:24,022 INFO [main] core.CollectionFactory (CollectionFactory.java:66) - JDK 1.4+ collections available
2009-01-16 12:47:24,032 INFO [main] core.CollectionFactory (CollectionFactory.java:71) - Commons Collections 3.x available
2009-01-16 12:47:24,965 INFO [analysisExtract] controller.Controller initConfig (Controller.java:343) - The controller config has been initialized
2009-01-16 12:47:24,975 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:102) - Initializing process engine
2009-01-16 12:47:24,975 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:105) - Loading parameters
2009-01-16 12:47:24,975 INFO [analysisExtract] config.LastRun load (LastRun.java:101) - Last run info will be saved in file: C:\Program Files\salesforce.com\Apex Data Loader 14.0\bin\..\conf\analysisExtract_lastRun.properties
2009-01-16 12:47:24,975 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:114) - Logging in to: https://www.salesforce.com
2009-01-16 12:47:24,985 INFO [analysisExtract] client.PartnerClient connectImpl (PartnerClient.java:156) - Beginning Partner Salesforce login ....
2009-01-16 12:47:25,006 INFO [analysisExtract] client.PartnerClient connectImpl (PartnerClient.java:165) - Salesforce login to https://www.salesforce.com/services/Soap/u/14.0 as user xxxxxxxxxxxx
2009-01-16 12:47:26,009 INFO [analysisExtract] dao.DataAccessObjectFactory getDaoInstance (DataAccessObjectFactory.java:51) - Instantiating data access object: C:\Program Files\salesforce.com\Apex Data Loader 14.0\conf\analysisExtract.csv of type: csvWrite
2009-01-16 12:47:26,009 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:119) - Checking the data access object connection
2009-01-16 12:47:26,009 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:124) - Setting field types
2009-01-16 12:47:26,822 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:128) - Setting object reference types
2009-01-16 12:47:30,715 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:132) - Creating Map
2009-01-16 12:47:30,715 INFO [analysisExtract] action.ActionFactory getActionInstance (ActionFactory.java:64) - Instantiating operation: extract
2009-01-16 12:47:30,715 INFO [analysisExtract] controller.Controller executeAction (Controller.java:125) - executing operation: extract
2009-01-16 12:47:31,136 INFO [analysisExtract] progress.NihilistProgressAdapter setSubTask (NihilistProgressAdapter.java:68) - Processed 500 of 621 total records. Rate: 0 records per hour. Estimated time to complete: 0 minutes and 0 seconds. There are 500 successes and 0 errors.
2009-01-16 12:47:31,337 INFO [analysisExtract] progress.NihilistProgressAdapter setSubTask (NihilistProgressAdapter.java:68) - Processed 621 of 621 total records. Rate: 11122000 records per hour. Estimated time to complete: 0 minutes and 0 seconds. There are 621 successes and 0 errors.
2009-01-16 12:47:31,337 INFO [analysisExtract] progress.NihilistProgressAdapter doneSuccess (NihilistProgressAdapter.java:55) - The extract has fully completed. There were 621 successful extracts and 0 errors.


Although it says it was successful, when you open the file analysisExtract.csv you get:

"ID"
""
""
""
""
""

with 621 empty strings (not just 5 as shown above).

Here is the bean that runs from process-conf.xml (login info deleted):



class="com.salesforce.lexiloader.process.ProcessRunner"
singleton="false">
analysisExtract downloads Analysis data from salesforce using 'extract' and puts them into a csv file.


























So apparently the code ran correctly (no errors) and did generate a csv file with 621 entries as expected but there was no data in any of them. Also what happened to the other fields requested in the SOQL call i.e. Account__c, Name, and Sampling_Date__c?

If I remove the "Id" field from the SOQL call then I get an error as in the following output file:

2009-01-16 13:00:58,796 INFO [main] controller.Controller initLog (Controller.java:388) - The log has been initialized
2009-01-16 13:00:58,806 INFO [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:78) - Loading process configuration from config file: C:\Program Files\salesforce.com\Apex Data Loader 14.0\bin\..\conf\process-conf.xml
2009-01-16 13:00:58,846 INFO [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:163) - Loading XML bean definitions from file [C:\Program Files\salesforce.com\Apex Data Loader 14.0\bin\..\conf\process-conf.xml]
2009-01-16 13:00:58,906 INFO [main] core.CollectionFactory (CollectionFactory.java:66) - JDK 1.4+ collections available
2009-01-16 13:00:58,906 INFO [main] core.CollectionFactory (CollectionFactory.java:71) - Commons Collections 3.x available
2009-01-16 13:00:59,829 INFO [analysisExtract] controller.Controller initConfig (Controller.java:343) - The controller config has been initialized
2009-01-16 13:00:59,839 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:102) - Initializing process engine
2009-01-16 13:00:59,839 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:105) - Loading parameters
2009-01-16 13:00:59,839 INFO [analysisExtract] config.LastRun load (LastRun.java:101) - Last run info will be saved in file: C:\Program Files\salesforce.com\Apex Data Loader 14.0\bin\..\conf\analysisExtract_lastRun.properties
2009-01-16 13:00:59,839 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:114) - Logging in to: https://www.salesforce.com
2009-01-16 13:00:59,849 INFO [analysisExtract] client.PartnerClient connectImpl (PartnerClient.java:156) - Beginning Partner Salesforce login ....
2009-01-16 13:00:59,869 INFO [analysisExtract] client.PartnerClient connectImpl (PartnerClient.java:165) - Salesforce login to https://www.salesforce.com/services/Soap/u/14.0 as user xxxxxxxxxxx
2009-01-16 13:01:01,093 INFO [analysisExtract] dao.DataAccessObjectFactory getDaoInstance (DataAccessObjectFactory.java:51) - Instantiating data access object: C:\Program Files\salesforce.com\Apex Data Loader 14.0\conf\analysisExtract.csv of type: csvWrite
2009-01-16 13:01:01,093 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:119) - Checking the data access object connection
2009-01-16 13:01:01,093 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:124) - Setting field types
2009-01-16 13:01:01,996 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:128) - Setting object reference types
2009-01-16 13:01:05,909 INFO [analysisExtract] process.ProcessRunner run (ProcessRunner.java:132) - Creating Map
2009-01-16 13:01:05,909 INFO [analysisExtract] action.ActionFactory getActionInstance (ActionFactory.java:64) - Instantiating operation: extract
2009-01-16 13:01:05,909 INFO [analysisExtract] controller.Controller executeAction (Controller.java:125) - executing operation: extract
2009-01-16 13:01:05,909 ERROR [analysisExtract] csv.CSVFileWriter setColumnNames (CSVFileWriter.java:239) - Error opening CSV file for writing: header row (with column names) has to be provided
2009-01-16 13:01:05,919 ERROR [analysisExtract] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:51) - Error opening CSV file for writing: header row (with column names) has to be provided

See http://forums.sforce.com/sforce/board/message?board.id=scontrols&message.id=1930&query.id=22853#M1930
for a similar but different problem with Data Loader 12.0.

Can anyone shed some light on this?

If we can solve this one I would like to attack the problem with the Upsert failing on Insert as well.

Thanks for your help.

Paul Crawford