Professional Documents
Culture Documents
Integration Using Email Exercise Guide
Integration Using Email Exercise Guide
APEX
(INTEGRATION USING
EMAIL)
Exercise Guide
EXERCISE GUIDE
Integration Using Email
Table of Contents
Exercise 4-1: Integrating with Force.com Email Services ............................................................... 1
Appendix A – Generating a Security Token .................................................................................... 3
Appendix B – Registering Visual Studio.......................................................................................... 4
Appendix C – Create Your Own Instances of the Workbench and Axiom Applications ............... 5
Appendix D – Connecting through a Proxy Server......................................................................... 6
EXERCISE GUIDE
Integration Using Email
Instructions:
1. Configure a Force.com email service.
A. Log in to Salesforce, navigate to Setup | Develop | Email Services and click New
Email Service.
B. Populate the form with the following values:
Email Service Name: CandidateEmailService
Note: You may need to type this in if it does not appear in the list.
Apex Class: CandidatePositionEmailHandler
Accept Attachments: All
Active: Checked
Failure Response Settings: Bounce Message (for all options)
C. Click Save and New Email Address.
D. On the following page, clear out any values specified on the Accept Email From
textbox.
E. Click Save.
F. Take note of the email address listed in the Email Address field.
2. Test the Email Service.
A. In Salesforce, navigate to the Home tab and click the Position Application Form link
within the Custom Links section on the sidebar.
Review
1. How was the Apex email handler class able to read in values from the inbound email
body and map them to Salesforce object fields?
2. What architectural changes might you make to this email “integration” if you were to
implement this using your real corporate website?
Instructions:
1. Customize the admin user to use your email.
A. Navigate to Your Name | My Settings | Personal | Personal Information.
B. Modify the Email field to be an email address you can access during class.
C. Click Save.
2. Generate a security token.
A. Navigate to Your Name | My Settings | Personal | Reset My Security Token.
B. Click on Reset Security Token.
C. Look in your email for the token.
Appendix C – Create Your Own Instances of the Workbench and Axiom Applications
Follow these instructions to create your own instances of Workbench and Axiom by
deploying the application to Heroku.
Instructions:
1. Deploy Workbench and Axiom to Heroku.
A. For Workbench, open a new tab and navigate to
http://github.com/ryanbrainard/forceworkbench. For Axiom, open a new
tab and navigate to https://github.com/ryanbrainard/axiom.
B. Scroll down and click Deploy to Heroku.
C. Log in to Heroku.
i. If you do not have a Heroku account already:
a. Enter your name in the Full Name field.
b. Enter an email address in the Email field.
c. Click Create Free Account.
d. Log in to the email account you specified above. You will have a confirmation
email from Heroku. Click the confirmation link to activate your account.
e. Enter a password of your choice.
f. Confirm your password.
g. Click Set password and log in. Wait for Heroku to take you to the New App
setup page for Workbench or Axiom.
ii. If you already have a Heroku account:
a. Click Log In (under the Create Free Account button).
b. Enter your Heroku account credentials
c. Click Log In. Wait for Heroku to take you to the New App setup page for
Workbench or Axiom.
D. Enter a unique app name in the App Name field, or leave it blank if you would like
Heroku to create an app name for you.
E. Click Deploy for Free, and wait while the application is deployed.
F. You will see deployment progress at the bottom of the page. When the page
indicates that your app has been successfully deployed, click the View it link.
<proxy usesystemdefault="True"
proxyaddress="proxyServer.corp.myCorp.com: 8080"/>
</defaultProxy>
</system.net>
Note: It is possible that the exercise file you have has commented code already
present to access the proxy server and all you will have to do is uncomment the
applicable lines of code. By setting the useDefaultCredentials parameter to
true, you should not need to enter your network credentials or NT Domain name.
Also, the proxyaddress should be the IPv4 address or URL portion of what was
returned in Step 1A above. The server address and port number values should be
separated with a colon.
C. Press Ctrl+S to save.
D. Follow the remaining exercise instructions to complete testing the solution.
config.setProxy("proxyServer.corp.myCorp.com",8080);
Note: It is possible that the exercise file you have has commented code already
present to access the proxy server and all you will have to do is uncomment the
applicable lines of code. Also, the first part of the address should be the IPv4
address or URL portion of what was returned in Step 1A above, followed by a colon
and then the port number.
C. Optionally, specify the NT Domain name and network credentials used to access the
proxy server through the following additional lines of code:
config.setNtlmDomain("NtlmDom");
config.setProxyUsername("proxyUserName");
config.setProxyPassword("***");