Decoding Salesforce

Decoding Salesforce

The hows and whys of Salesforce.com

Author Archive

sfdc-web2anything

Long time no update. I know, I know..

We’ve launched an opensource project to help you generate web forms for the live collection/insertion of data in any standard or custom Salesforce.com object.

sfdc-web2anything

Although Salesforce.com Sites will soon be in Developer Preview, we thought that some Salesforce.com customers could find it useful.

Check the project website for details at Google Code: http://code.google.com/p/sfdc-web2anything/

Inline Google Maps

Many have asked me how to integrate Google Maps in a Salesforce.com page to pinpoint a specific address on the map. The example we’re going to see today is how to add an inline map to pinpoint an Account billing address.

The finished product

Here’s a screenshot of what we are going to get:
Inline Google Maps

Let’s get started

Right so, let’s see what we need:

  1. First off you need a Google Map API Key you can obtain for free from here; it’s necessary to embed Google Maps in your own web pages. When requested to insert your website URL, enter the name of the instance you’re on, complete with https:// (e.g.: https://emea.salesforce.com/ )
  2. Then, within Salesforce.com, navigate to Setup > Customize > Develop > S-Controls > New S-Control; specify a Label (e.g.: “Inline GMaps”), set the Type to be HTML, in the HTML Body section paste the following code (don’t forget to substitute YOUR-GOOGLE-MAPS-API-KEY-HERE with the Google Maps API Key you created in step #1), then Save.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=YOUR-GOOGLE-MAPS-API-KEY-HERE" type="text/javascript"></script>
    <script type="text/javascript">
    var map = null;
    var geocoder = null;
    var address = "{!Account.BillingStreet}, {!Account.BillingPostalCode} {!Account.BillingCity}, {!Account.BillingState}, {!Account.BillingCountry}";
    function initialize() {
    if (GBrowserIsCompatible()) {
      map = new GMap2(document.getElementById("map_canvas"));
      map.addControl(new GSmallMapControl());
      geocoder = new GClientGeocoder();
      geocoder.getLatLng(
        address,
        function(point) {
          if (!point) {
            document.getElementById("map_canvas").innerHTML = address + " not found";
          } else {
            map.setCenter(point, 13);
            var marker = new GMarker(point);
            map.addOverlay(marker);
            marker.bindInfoWindowHtml("{!Account.Name}");
          }
        }
      );
    }
    }
    </script>
    </head>
    <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width:100%;height:300px"></div>
    </body>
    </html>
    
  3. Next, navigate to Setup > Customize > Accounts > Page Layouts and click on Edit next to the correct page layout (you might only have one). Click on Create New Section with Name “Google Maps”, “Single” Columns, leave the two checkboxes checked and click Ok.
    Now, on the right hand side of the screen, from the View dropdown list, select Custom S-Controls; you’ll see the newly created S-Control (e.g.: “Inline GMaps”) and all you need to do is to drag and drop that component into the newly created section.
    Lastly, double-click on the S-Control component now in the section: a popup window will appear. Make sure the Width (in pixels or %) is 100%, set the Height (in pixels) to 300 and untick both the underneath checkboxes.
  4. All done! :) Navigate to one of your Account records and verify the map is displaying correctly!

I’m not going to analyse the S-Control line by line, with a little knowledge of HTML and JavaScript you should be able to modify it to suit your needs, but please let me know if you have any issues.

Using Email2Case with Google’s Gmail

I like Google, infact, I really love many of Google’s apps. There are many reasons to use Gmail – Google’s ‘new kind of webmail’ – and one of those is that it offers IMAP access. This is great for those of you who’ve been waiting to use the Salesforce’s Email2Case tool, and today I’m going to explain how to configure it to be used with Gmail.

Email2Case? What is it?

Email2Case ‘is a toolkit that pulls emails from your mail server and uses the Force.com API to create new cases or append to an existing case‘. In order to get more information about the tool and download it, please navigate here (note you will need a free developer account to access the page, you can subscribe for one here).

Gmail, Email2Case and Salesforce configuration

  1. First of all we need to subscribe for a free Gmail Account: navigate to the Signup Page, fill in the required information and in no time you’ll have obtained a new account.
  2. Email2Case will process the Gmail Inbox folder, but we also need to create the folders (Gmail calls them Labels) where the Processed or Error emails will go: so, within Gmail, let’s click on “Settings” > “Labels” and create 2 new labels: Error and Processed. That’s it, we’re done configuring Gmail.
  3. Now we need to work on the two Email2Case config files: email2case.txt and sfdcConfig.txt. If you haven’t already done so, download the Email2Case Toolkit and navigate to the directory where you have unzipped it (I keep it in C:\Email2Case).
    • First let’s have a look at the email2case.txt. You’ll only need to change username@gmail.com and gmail_password with your newly created gmail address and password.
      <configFile>
          <server1>
              <url>imap.gmail.com</url>
              <protocol>imaps</protocol>
              <userName>username@gmail.com</userName>
              <password>gmail_password</password>
              <interval>1</interval>
              <inbox>Inbox</inbox>
              <readbox>Processed</readbox>
              <errorbox>Error</errorbox>
          </server1>
      </configFile>
      
    • And now sfdcConfig.txt. Once again, the changes you’ll have to make are pretty straight-forward: just change salesforce_username_here and salesforce_password_here with your real Salesforce.com username and password.
      <configFile>
          <sfdcLogin>
              <url>https://www.salesforce.com/services/Soap/u/9.0</url>
              <userName>salesforce_username_here</userName>
              <password>salesforce_password_here</password>
              <loginRefresh>30</loginRefresh>
              <timeout>5000</timeout>
          </sfdcLogin>
          <notify>
        <notifyEmail></notifyEmail>
              <from></from>
              <host>smtp.gmail.com</host>
        <port>465</port>
              <user></user>
              <password></password>
              <service>com.sforce.mail.SMTPNotification</service>
          </notify>
          <attachments>
              <largeAttachmentDirectory>C:\EmailAgent\LargeAttachments</largeAttachmentDirectory>
              <largeAttachmentURLPrefix>file:\\C:\EmailAgent\LargeAttachments</largeAttachmentURLPrefix>
              <largeAttachmentSize>1</largeAttachmentSize>
          </attachments>
          <services>
              <com.sforce.mail.EmailService>C:\\EmailAgent\\email2case.txt</com.sforce.mail.EmailService>
          </services>
      </configFile>
      
  4. We’re almost ready, the last thing to do is to enable Email2Case in Salesforce.com and verify that everything works as expected. Login onto your Salesforce.com Organization and navigate to: Setup > Customize > Cases > Email-to-Case. Follow the steps to enable Email2Case and add the gmail address we created earlier as a “Routing Address”. That’s it, we should be set!
  5. Start the Email2Case Agent by double clicking on the email2case.bat file and make sure you get no errors, send an email to the gmail address and as soon as the Email2Case will pick that up, a new case will be created in your Salesforce.com Org.

If you need further help setting up the Email2Case Agent, please refer to this Salesforce.com Help page.

New look, new life

Decoding Salesforce is back with a brand new look! We’ve been busy during the last few months, but we’ll find some time to write something new in this space. Let us know what you think about the new skin; stay tuned for more :)

How to obtain a field ID

Often people ask me how to get fields IDs in order to build their custom links. I thought it would have been helpful to write a post about this. Let’s see how to get a field ID for custom and standard fields.

Custom Fields

In order to get the ID of a custom field proceed this way:

  • Click on Setup, then on Customize, select the Object you desire (e.g.: Leads) and click on Fields;
  • Click on the name of the custom field you previously created
  • Look at your browser’s address bar, you’ll see something like:
    https://emea.salesforce.com/00N20000000thpj
  • The 15 digit code that appears immediately after https://emea.salesforce.com/ is the ID of that custom field; in this case the ID of the custom field I selected is 00N20000000thpj

Easy enough, isnt’t it :)

Standard Fields

Salesforce.com provides a list of the field’s name for its standard fields, which can be found attached to the solution “How do I create custom links?” and that I decided to paste here as a quick reference:

EVENTSField TypeID
Assigned ToIDevt1_lkid
Textevt1_lkold
Subjectevt5
WhoPicklistevt2_mlktp
IDevt2_lkid
Textevt2

WhatPicklistevt3_mlktp
IDevt3_lkid
Textevt3
PrivateIsPrivate
Activity Currencyevt9
Locationevt12
Dateevt4

Timeevt13
All Day Eventevt15
Typeevt10
Show Time AsShowAs
Descriptionevt6
TASKSField TypeID
Assigned ToIDtsk1_lkid
Texttsk1
Subjecttsk5
Due Datetsk4
Statustsk4
WhoPicklisttsk2_mlktp
IDtsk2_lkid

Texttsk2
WhatPicklisttsk3_mlktp
IDtsk3_lkid
Texttsk3
Commentstsk6
Notify by Emailemail
CAMPAIGNSField TypeID
Campaign Namecpn1
Typecpn2
Statuscpn3
Start Datecpn5
End Datecpn6
Expected Revenuecpn8

Budgeted Costcpn9
Actual Costcpn10
Expected Response %cpn11
Campaign Currencycpn7
Number Sentcpn13
Activecpn16
Descriptioncpn4

LEADSField TypeID
SalutationPicklistname_salutationlea2
First Namename_firstlea2
Last Namename_lastlea2
Companylea3
Titlelea4

Lead Sourcelea5
Industrylea6
Annual Revenuelea7
CampaignIDlea20_lkid
Textlea20_lkold
Descriptionlea17
Phonelea8

Mobilelea9
Faxlea10
Emaillea11
Websitelea12
Lead Statuslea13
Ratinglea14
# of Employeeslea15

Email Opt Outlea22
Streetlea16street
Citylea16city
State/Provincelea16state
Zip/Postal Codelea16zip
Countrylea16country
Use Assignment Rulelea21

ACCOUNTSField TypeID
Account Nameacc2
Account Siteacc23
Account Numberacc5
Typeacc6
Industryacc7

Annual Revenueacc8
Account Currencyacc24
Ratingacc9
Phoneacc10
Faxacc11
Websiteacc12
Ticker Symbolacc13

Ownershipacc14
Employeesacc15
SIC Codeacc16
Billing Streetacc17street
Billing Cityacc17city
Billing State/Provinceacc17state
Billing Zip/Postal Codeacc17zip

Billing Countryacc17country
Shipping Streetacc18street
Shipping Cityacc18city
Shipping State/Provinceacc18state
Shipping Zip/Postal Codeacc18zip
Shipping Countryacc18country
Descriptionacc20

CONTACTSField TypeID
SalutationPicklistname_saluatationcon2
First Namename_firstcon2
Last Namename_lastcon2
AccountIDcon4_lkid
textcon4_lkold

Titlecon5
Departmentcon6
Birthdatecon7
Reports ToIDcon8_lkid
Textcon8_lkold
Lead Sourcecon9
Contact Currencycon21

Phonecon10
Home Phonecon13
Mobilecon12
Other Phonecon14
Faxcon11
Emailcon15
Assistantcon16

Asst. Phonecon17
Email Opt Outcon23
Mailing Streetcon19street
Mailing Citycon19city
Mailing State/Provincecon19state
Mailing Zip/Postal Codecon19zip
Mailing Countrycon19country

Other Streetcon18street
Other Citycon18city
Other State/Provincecon18state
Other Zip/Postal Codecon18zip
Other Countrycon18country
Descriptioncon20
OPPORTUNITIESField TypeID
Nameopp3
AccountIDopp4_lkid
Textopp4_lkold
Typeopp5
Lead Sourceopp6
Forecast CategoryForecastCategory

Opportunity Currencyopp16
Amountopp7
Close Dateopp9
Next Stepopp10
Stageopp11
Probabilityopp12
Campaign SourceIDopp17_lkid

Textopp17_lkold
Descriptionopp14
CONTRACTSField TypeID
AccountIDctrc7_lkid
Textctrc7_lkold
Customer Signed ByIDctrc16_lkid
Textctrc_lkold
Customer Signed TitleCustomerSignedTitle
CustomerSignedTitlectrc6
Contract CurrencyCurrencyIsoCode
Price Bookctrc17

Statusctrc15
Contract Start Datectrc5
Contract Terms(months)ctrc40
Owner Expiration Noticectrc13
Company Signed ByIDCompanySigned_lkid
TextCompanySigned_lkold
Company Signed DateCompanySignedDate

Billing Streetctrc25street
Billing Cityctrc25city
Billing State/Provincectrc25state
Billing Zip/Postal Codectrc25zip
Billing Countryctrc25country
Special TermsSpecialTerms
DescriptionDescription

CASESField TypeID
ContactIDcas3_lkid
Textcas3_lkold
Typecas5
Case Reasoncas6
Case Currencycas24

Statuscas7
Prioritycas8
Case Origincas11
Visible in Portalcas27
Subjectcas14
Internal CommentsCas15
Assignment Rulescas21

Send notification to Contactcas22
SOLUTIONSField TypeID
NameSolutionName
DetailsSolutionNote
PRODUCTSField TypeID
NameName
Product CodeProductCode
Quantity Scheduling EnabledCanUseQuantitySchedule
Product CurrencyCurrencyIsoCode
DescriptionDescription
ActiveIsActive
Product FamilyFamily

Revenue Scheduling EnabledCanUseRevenueSchedule
Quantity Schedule TypepQST
Quantity Installment PeriodpQSI
Number Of Quantity InstallmentspQSN
Revenue Schedule TypepRST
Revenue Installment PeriodpRSI
Number Of Revenue InstallmentspRSN

DOCUMENTSField TypeID
NameName
Internal Use Onlyiuo
Externally Available Imagepub
Folderpid
Descriptiondesc

Keywordskey

Questions? ;)

Page 1 of 212»