Skip to content

Connecting to a Sandbox

AndrewO edited this page Sep 13, 2010 · 1 revision

Salesforce allows some users (depending on level) to create sandboxed environments for developing new customizations. After creating a sandbox, users login through the browser by going to test.salesforce.com and appending .#{name of sandbox} to the end of their normal username.

Using dm-salesforce to access a sandbox through the API requires a similar process. Generally, you should be able to get in with the following changes:

  1. Add the sandbox name to the end of your login name as above.
  2. Append your security token as you would to login to the standard environment.
    • Note that if you need to reset your security token, you’ll first need to change your email address as it will append the sandbox name by default.
  3. Replace your WSDL file with the one from the sandbox as the sandbox uses a different port location.
    • Important: If you’re using the same file name for this WSDL file as a previous one, you must remove the cached API files. Otherwise, the classes generated from the production WSDL definitions will continue to be used and you’ll get errors like INVALID_LOGIN: Invalid username or password or locked out. (SOAP::FaultError). These will generally be found in the ~/.salesforce directory.

Example settings:


DataMapper.setup(:default, 
  {
    :adapter  => 'salesforce',
    :username => '[email protected]',
    :password => 'mypass56854890adasdrandomsecuritytoken',
    :path     => File.expand_path(File.dirname(__FILE__)+'/enterprise.wsdl.xml'),
    :host     => ''
  })
Clone this wiki locally