Skip to content

☁️ A hands-on, deep yet quick introduction to Salesforce

Notifications You must be signed in to change notification settings

wilsonmar/Salesforce

Repository files navigation

This is intended to be a hands-on guided introduction such that experience developers new to Salesforce can get to know the offering deeply yet quickly.

This is a living document and will continue to be updated with more helpful information and examples as they become available. QUESTION: and ??? mark where I need input.

Much of the contents of this file has been transferred to my blog and expanded there. A list of the blog entries related to Salesforce is at https://wilsonmar.github.io/salesforce

Please Contribute

Content in this repo is Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) unless otherwise stated

I welcome you to contribute on this GitHub https://github.com/wilsonmar/Salesforce. When this repo is changed, changes are pushed to Gitbook.io automatically.

Editing the book can be done either by updating the markdown files with a text editor, or opening the repository in the Gitbook desktop app. The desktop app will give you a live preview option.


Developer Setup

  1. Get a developer account from http://developer.salesforce.com/signup (= http://sforce.co/WBtUN7) for a Developer Edition (DE) environment.

    PROTIP: During registration, the Username needs to be in the form of an email address. But email is not sent to the username, so you can use something unique such as "wilsonmar-234@jetbloom.com" where -234 is unique to another developer instance.

    PROTIP: Have a "main" developer environment that you tell people and use for social Chatter and Help. Other accounts you use only to log in secretly.

  2. When the email "Your Developer Edition Login Information" arrives, click on the link to change password.

    PROTIP: Use the unique portion in your password to make it easier to remember.

  3. Turn on Developer from Setup | Personal Information. Click Edit. Scroll to click Development Mode and Show View State in Development Mode. Save.

Salesforce User Home UI

  1. Go to webpage login.salesforce.com

The blue sausage (app selector) at the upper-right lists apps. An app is a group of tabs that work as a unit to provide functionality. Users can switch between apps using the Force.com app drop-down menu at the top-right corner of every page. 2,700+ apps have been created by Salesforce partners.

Standard apps:

  • Call Center
  • Community
  • Content
  • Marketing
  • Sales
  • Salesforce Center

A custom landing page can be configured for custom apps.

  1. Clicking on a menu item displays on the main window in the middle of the screen.

    Each app has a different set of menu tabs going across the screen, beginning with Home

    A key differentiator with Salesforce is that, unlike menus on Mirosoft Office software, which has menu items focused on user actions such as Edit and Print, Salesforce menu items are focused on information such as Opportunities and Contacts.

  2. Click the [+] at the right end of the menu.

    Instances among Orgs

  3. After login, note the URL, such as https://na31.salesforce.com/...

    The "na31" in this case is the "multi-tenant" instance identifier used by about 8,000 customers (tenants) each on the same hardware infrastructure.

    Multi-tenancy is what has enabled Salesforce to offer services to SMB at an affordable price.

    Salesforece maintains 50 production instances (potentially 400,000 orgs). Currently, Salesforce reportedly has 55,000 enterprise customers and 1.5 million individual subscribers.

  4. Availability history of each instance is listed at http://www.trust.salesforce.com/trust/instances

  5. The mobile version of instance na31 is at URL:

    https://na31.salesforce.com/one/one.app

  6. Click the "pancake" / "hamburger" icon at the upper left.

  7. Click "Show more".

    The One UI is more similar to Apple in confirmation icons at the upper right and go back/cancel icons on the upper left.

    MORE READING: Salesforce1 Mobile Basics > Getting Started with the Salesforce1 Mobile App https://developer.salesforce.com/trailhead/salesforce1_mobile_app/salesforce1_mobile_app_intro

Corporate Global Settings Defaults

To set OWD (Organization-Wide Defaults), such as Fiscal Year start date, Record Currency.

  1. Click Setup at the upper-right corner.

A Locale selection determine how dates, time, numbers, names are displayed, based on Language, Locale, Time Zone.

  • Company Profile
  • UI Settings
  • Calendar Settings
  • Search Settings
  • Chatter

Permissions

The 6 standard profiles of permissions:

  • Administrator
  • Solution Manager
  • Read Only
  • Standard User
  • Marketing User
  • Contract Manager

Up to 1000 Permission sets per org can be setup to grant additional permissions without changing user profiles.

One-time User Setup

  1. Click Setup at the upper-right corner.

    Selections in the left-menu is organized into Administer, Build, Deploy, and Monitor.

Setup video

  1. [__] Setup verification to mobile phone.

  2. [__] Setttings: Personal: Language & Time Zone.

  3. [__] Add a photo of yourself https://na31.salesforce.com/_ui/core/userprofile/UserProfilePage?tab=sfdc.ProfilePlatformFeed

  4. [__] Setttings: Personal: Advanced User Details: Use a token generated from an authenticator app on your mobile device. https://play.google.com/store/apps/details?id=com.salesforce.authenticator

Two-factor authentication

https://trailhead.salesforce.com/modules/identity_login

  1. On your iOS or Android, open the store app to search for "Salesforce Authentictor".
  2. Log onto Salesforce https://login.salesforce.com/ as Administrator of your DE org.
  3. In Lightning Experience, click the setup icon, Setup Home.
  4. From Setup, enter Permission in the Quick Find box, then select Permission Sets.
  5. Label: "2fa Auth for User Logins".
  6. API Name: "X2fa_Auth_for_User_Logins".
  7. Click Save.
  8. Under Recent Items or System, click System Permissions. Now you’re on the detail page for the "2fa Auth for User Logins" permission set.
  9. Click Edit.
  10. Select "Two-Factor Authentication for User Interface Logins".
  11. Click Save.

Standard UI Declarative

Collapsable Sidebar can be enabled to reduce horizonal scrolling.

  1. Create a new page layout for the Contacts object.

Most Common UI Actions and Keyboard Shortcuts

Salesforce does not provide keyboard shortcuts in the Setup "Aloha" UI. However, if you have downloaded Google Chrome, you can add-on Salesforce Hotkeys at https://chrome.google.com/webstore/detail/salesforce-hotkeys-beta/hkpmdgakkflkddmiffelfaokkgoamlil?hl=en

Up to 10 Recent Items are displayed.

The list of hotkeys is here.

CTRL + ALT/Option is used to select tabs:

  • G = List view
  • R = Reports

CTRL + SHIFT + F or META + SHIFT + F keys are used to Find text in the Search box.

CTRL + key within a dialog:

  • E = Edit
  • S = Save
  • Q = Quit / Cancel

Key directly to specific object

CTRL + SHIFT or META + SHIFT keys are used to select Create New:

  • A = Account (with related contacts, opportunities, and cases)
  • C = Contact (of individual people)
  • O = Opportunity (associated with a Contact in an Account with potential sales)
  • L = Lead (associated with campaigns)

Additionally:

  • R = Report
  • T = Task
  • E = Event
  • S = Suggestion

The other standard objects that are the bread-and-butter data Salesforce CRM was built to handle:

  • ? = Case
  • ? = Solution
  • ? = Campaign

Recycle Bin

When a customer object is deleted, Salesforce does not immediately add it to the Recycle Bin. Instead, deleted objects appear in the Deleted Objects list for 15 days. During an object's "soft deleted" time, it can be restored before being permanently erased (hard deleted).

Soft-deleted custom objects and their data still count against your organization’s limits; hard-deleted items do not.

See them in the Schema Browser.

Sandbox

Sandboxes are copies of your organization in a separate environment. They are used for development and testing. See Sandbox Overview at https://help.salesforce.com/HTViewHelpDoc?id=create_test_instance.htm&language=en_US

Changesets are used release to production.

PROTIP: Most professional developers prefer to use the Force.com IDE with a local copy rather than the on-line Developer Console to avoid losing work if a refresh occurs.

Revision to earlier changes may not be possible.

PROTIP: Build your own instrumentation.

See https://na31.salesforce.com/_ui/common/apex/debug/ApexCSIPage


Build Conference App

Build a Conference Management App used during Step-by-step Salesforce1 Developer Workshop. Click "Start Now" on that page and you'll get to the github.io website created by Christophe Coenraets, of http://coenraets.org/blog/ (Salesforce Developer Evangelist by day and Ionic Framework expert at night). Questions and questions about the trailhead content can be entered in the Disqus component in

makes use of Connected app whose source is in a github repo that contains http://goratchet.com/ CSS library and ForceTK (https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit) to integrate with Salesforce.

Visualforce includes its own ExtJS JavaScript library.

Apex remoting forms an async parametized bridge between JavaScript and Apex.

Reports and Dashboards

Join the Reports & Dashboards group

Build Suggestion Box App

Build a Suggestion Box shows how to create reports and dashboards.

Questions and questions about the content can be entered in the Disqus component in the github.io website Advanced Developer Workshop generated from a github repo.

Invoice app with Francis Pindar

Francis Pindar (Londoner, 6X MVP, @radnip, radnip.com) at ACLoud.Guru created a Salesforce 101 video course and a whole Salesforce Certified Administrator 2018, which builds an invoice app over 12 hours of video, using the Aug. 2016 version of the Salesforce classic experience.

Lynda

Learn Salesforce: The Basics 10/14/2016 1h 39m by Christine V Pereira

Pluralsight Tutorials

As of Feb 2017, Pluralsight has 18 videos on Salesforce, from 2013 to 2016:

Dan Appleman

Don Robins

Force.com Platform - The Big Picture [Beginners] 1h 24m 29 Jan 2013

Adam Purkiss

Force.com Design Patterns - Part 1 [Intermediate] Nov 26 2012 3h 2m Force.com Design Patterns - Part 2 [Intermediate] May 1 2013 1h 45m

Richard Seroter

Using Force.com Integration APIs to Connect Your Applications [Intermediate] Mar 8 2016 5h 14m Force.com for Developers [Intermediate] Aug 23 2012 5h 47m

Matt Lacey

Introduction To Visualforce [Intermediate] Jul 31 2013 2h 32m

Atlassian Confluence https://tddprojects.atlassian.net/wiki/spaces/SF/overview https://tddprojects.atlassian.net/wiki/spaces/SF/pages/239534121/Actions+Examples

Sara Morgan created Getting Started Building SPAs with Lightning Component Framework Apr 26 2016, 2h 26m

Building Your First Salesforce Application 28 Feb 2018 by Scott Allen

Dev Tools

  • Developer Console online (look in the pull-down under your name), which opens a new browser window.
  • Force CLI
  • Force.com IDE plugin on top of Eclipse
  • Mavens Mate plugin on top of SublimeText

Apex Coding

Force.com Apex Code Developer's Guide

Mobile Apps

The Salesforce1 mobile emulator is at http://instance ID.salesforce.com/one/one.app See this.

Mobile apps for iOS and Android:

  • Salesforce Authenticator for 2FA
  • SalesforceA, the mobile app for admins for Android and iOS.
  • Salesforce1 mobile app for end-users for Android and iOS.

WEBINAR: Building Mobile Apps using SDK by Akhilesh Gupta

Visualforce Tutorials

Visualforce coding is much like Ruby on Rails and Django. Visualforce generates HTML based on markup such as:

<apex:page standardController="Speaker__c">
<apex:form >
    <apex:pageBlock title="Edit Speaker">
        <apex:pageBlockSection columns="1">
            <apex:inputField value="{!Speaker__c.First_Name__c}"/>
            <apex:inputField value="{!Speaker__c.Last_Name__c}"/>
            <apex:inputField value="{!Speaker__c.Email__c}"/>
        </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="Save"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
</apex:form>
</apex:page>

Visualforce coding can declare logic such as a repeat loop:

<apex:repeatvalue="{!users}"var="user">
{!user}<br />
</apex:repeat>

Setting the default page is not the most intuitive. An example:

  1. In Setup, select Build > Create > Objects and click the Speaker object link.

  2. Scroll down to the Buttons, Links, and Actions section, and click Edit next to New.

  3. Check Override With Visualforce Page, and select SpeakerForm.

DISCUSSIONS: Visualforce Board

There was (31 Jul 2013) a 2h 32m Pluralsigh [paid] tutorial Introduction To Visualforce by Matt Lacey.

Bulk Actions

With its focus on UI, Salesforce does not provide a Bulk Delete natively. A Java wrapper is described in the 3h 2m [paid] Pluralsight tutorial from 26 Nov 2012 Force.com Design Patterns - Part 1 by Adam Purkiss.

There is also a 1h 45m 01 May 2013 Force.com Design Patterns - Part 2 by Adam Purkiss.

sample bulk API interface Ruby gem

MetaData

Metadata literally means data about data. Read https://developer.salesforce.com/page/An_Introduction_to_Force.com_Metadata

A Salesforce Org (short for organization) is a container for metadata that drives the dynamic engine (kernel).

Salesforce’s secret sauce: It queries its databases with “The Multi-Tenant Optimizer”

System objects are: User, Event, Activity, Task.

Object names generated are suffixed by two underlines followed by a letter:

  • __c for custom object.
  • __r for relationship to follow.
  • __s for latitude and longitude (a single compound geolocation field with two components).

https://help.salesforce.com/HTViewHelpDoc?id=custom_field_types.htm&language=en_US

LIMIT: Picklists are limited to 300 values

Use data type Text(encrypted) for credit card numbers and national ID such as US social security numbers. To keep users from editing:

  • Validation Rules
  • Field-level Security
  • Page Layout Settings

An object can have up to 3 external ID fields. External IDs (not case-sensitive) are used with upsert command to prevent duplication during import. But external IDs can only be data type number, unencrypted text, email (not phone).

WEBINAR: Encrypt Sensitive Data while Preserving Platform Functionality with Salesforce Summer '15 Shield "encryption as a service" feature bundle using customer-managed keys stored in the new TenantSecret sObject. This requires additional licensing.

Controller Extension

In the Create trail, an increment() method and a counter property can be added:

public with sharing class SpeakerControllerExtension {
    public Integer counter {get; set;}
    private final Speaker__c speaker;
    private ApexPages.StandardController stdController;
    public SpeakerControllerExtension(ApexPages.StandardController stdController) {
        this.speaker = (Speaker__c)stdController.getRecord();
        this.stdController = stdController;
        counter = 0;
    }
    public void increment() {
        counter++;
    }
}

Formulas

To access a graphic image, you need to create two data types: One is a 255-length text field namee Picture_path which is referenced by a Formula data type IMAGE(Picture_Path__c, '', 350,300) with Text return type.

In the Developer Console, see run output to System.Debug('Hello'); by filtering execution logs for just USER_DEBUG events.

  • IsChanged(Field) is based on whether the specific field value has changed.
  • PrioValue(Field) allows access to previous vale of the field.
  • IsNew() checks for create v/s update action.

For more about formula fields:

Apps and AppExchange Marketplace

https://appexchange.salesforce.com (described at http://www.salesforce.com/appexchange/overview/) is an online marketplace where you can browse, test drive, download, and install pre-built apps and components right into your Salesforce environment.

  1. Menu Build | Develop | AppExchange Marketplace.
  2. Search for apps by keyword.
  3. Get "Demo Jam" to watch short demos of various apps.
  4. Click Get It Now.

In 2015 Salesforce has 30M lines of code written by others via APPExchange at

Read https://www.salesforce.com/form/conf/platform-appguide.jsp

DOCUMENT: Application Installation Guide

Salesforce Wear https://developer.salesforce.com/wear includes a set of apps for Apple Watch, Google Glass, and more wearables that all access Salesforce data via APIs.

The highest rated 3rd-party apps:

  • Adobe EchoSign: This application adds enterprise document management functionality to Salesforce. EchoSign allows users and clients to view, edit, sign, track, and file cross-platform documents.

  • Informatica Cloud: This SaaS application is designed to simplify the integration of cloud-based Salesforce data with on-premise systems. Using pre-built connectors, Informatica makes it easy to synchronize Salesforce information with ERP, databases, and other on-premise systems.

  • Marketo Marketing Automation: Marketo is an application designed to integrate marketing efforts with Salesforce. It automates and simplifies the creation, support, and monitoring of marketing campaigns, while providing up-to-date information to the sales department.

Permissions

  • "Author Apex" permissions are necessary to use Search SOQL/SASL in the Query tab.
  • "View All Data" permissions are necessary to use the Developer Console
  • "Customize Applications" permissions are necessary to make changes to Apex, VisualForce, Lightning components.

Database Query

Because parent-child and other data relationships are defined up front in the Data Model UI, the Salesforce Object Query Language (SOQL) coded to retrieve filtered data does not allow dynamic implicit joins like those used in ANSI SQL. Furthermore, SOQL is like Microsoft's LINQ because it contains domain-specific names like "Opportunities".

There is also the Salesforce Analytics Search Language (SASL)

This approach enables Salesforce engineers to optimize indexing their own way, invisible to developers and users, such as returning variable data types in multi-dimensional arrays.

SOQL can be coded and executed dynamically within the Developer Console Query Editor. Examples:

for (Speaker__c s : [SELECT Email__c FROM Speaker__c])
{
    System.debug(s.email__c);
}

An example to retrieve "Rose Gonzalez" from "%rose%":

SELECT Id, Name, Phone, Account.Name  
       FROM Contact
       WHERE Phone <> null
       AND Name LIKE '%rose%'
       ORDER BY Name
       LIMIT 50

For a master-detail example:

SELECT Name,
       (SELECT FirstName, LastName, Phone
               FROM Contacts)
       FROM Account

Individual rows returned from SOQL can be dynamically edited, inserted, and deleted.

Junction Object is a custom object (of auto-number data type) joining two Master Detail Relationships.

DML

Salesforce Data Manipulation Language (DML) is coded in Apex classes and triggers to insert, update and delete data, in the Developer Console Anonymous Window.

See the Force.com SOQL and SOSL Reference

Some insert:

Session__c session = new Session__c();
session.name = 'Apex 101';
session.level__c = 'Beginner';
insert session;
Session__c session = new Session__c(
    name = 'Apex 201',
    level__c = 'Intermediate'
);
insert session;

Update sample:

String oldName = 'Apex 101';
String newName = 'Apex for Beginners';
Session__c session = �  [SELECT Id, Name FROM Session__c
                   WHERE Name=:oldName];
session.name = newName;
update session;

Sample Delete:

String name = 'Testing 501';
Session__c session =
   [SELECT Name FROM Session__c
               WHERE Name=:name];
delete session;

Sample Undelete: ???

Each trigger is coded in Apex to a particular sObject.

"(before insert, before update)" are coded as part of the definition.

Triggers work on lists of records, not single records. This is to support bulk operations (Data Import, Bulk API, etc.)

Example before trigger:

trigger on Account (before update) {
    for (Account acc: Trigger.New) {
        // Compare new value with old value
        if (acc.Rating != Trigger.oldMap.get(acc.Id).Rating) {
            // Your Logic
        }
    }
}

Example of after trigger:

trigger WelcomeKit on Account (after insert) {
    List<Case> cases = new List<Case>();
    for (Account account : Trigger.new) {
        Case case = new Case();
        case.Subject = 'Mail Welcome Kit';
        case.Account.Id = account.Id;
        cases.add(case);
    }
    insert cases;
}

Triggers are active as soon as they are saved.

Data Architecture

salesforce_data_schema

It doesn't have ORM (but seems to be there).

OrgID is hashed to one of 32 keys used to distribute. Smart Primary Keys and Polymorphic Foreign Keys. Creative de-normalization and pivoting.

Chatter

Chatter History maintains 72 hours of feeds.

A Chatter group has only one owner but can have many managers.

Search

Lists return 25 by default. But 5 - 50 can be set.

There is a maximum of 10 columns (fields)

Using Apache SOLR.

Salesforce is basically implementing Track (the ability to search and monitor conversations by keyword and topic)

Create forms and page layouts using drag-and-drop tools in the Page Layout editor.

Programming languages

C# .NET Programming

.NET C# Programming

DISCUSSIONS: .NET Development

Java Programming

Java Programming

DISCUSSIONS: <a target="_blank" href="https://developer.salesforce.com/forums/#!/feedtype=RECENT&dc=Java_Development&criteria=ALLQUESTIONS">
Java Development</a>

http://docs.aws.amazon.com/lambda/latest/dg/java-gs.html Getting Started (Authoring AWS Lambda Code in Java)

Clojure Programming

Most starred (and forked) public Github library for salesforce is Force.com mobile SDK for iOS applications

See https://github.com/owainlewis/salesforce

Debug Log

Debug logs can be obtained for other users.

Change Log Levels in the Debug menu.

3MB is the maximum size of a Debug Log. A message about truncated logs when truncation occurs.

Test Data

Each object is assigned an 18 character identifier for API transaction.

Each object is assigned a 15 character identifier for internal reporting and data loading.

Testing

Salesforce does not allow an app to deploy from a sandbox into production unless there is at least 75% coverage by tests.

PMD ("Programming Mistake Detector") source code analyzer finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, etc. in Apex code. It includes CPD, the copy-paste-detector. CPD finds duplicated code

Any modification of Apex code requires rerun of tests to refresh code coverage results. Salesforce also runs all tests before each major service upgrade and release to makes sure that no behavior in custom code has been altered as a result of any service upgrades.

Test classes don’t count toward the 3 MB maximum of Apex code in each org.

So construct test code in separate class file in the Developer Console | File | New Apex Class.

Decorating test code with @IsTest instead of the testMethod keyword allows parameters to be specified.

TUTORIAL: https://developer.salesforce.com/trailhead/module/apex_testing on the Apex testing framework providea example.

@isTest
private class MyTestClass {
    @isTest static void myTest() {
        // code_block
    }
}

There is usually more test code lines for coverage of various state/conditions.

  • testWarmTemp of 70
  • testFreezingPoint of 32
  • testBoilingPoint of 212
  • testNegativeTemp of -10

Tests should also cover null values.

public classes are used in test data factory.

Test methods cannot send emails or call external services, only use mock callouts in tests.

Use the System.Test.loadData() with static resource (such as a CSV file). PROTIP: Include the System. prefix in case a local Test class is created, which would cause test failure.

List<Contact> contacts = PrepareTestData.

SOSL searches performed in a test return empty results. To ensure predictable results, you can use Test.setFixedSearchResults() to define the records to be returned by the search.

https://www.iridize.com/ provides customized on-boarding guides based on specific workflows on Salesforce and other apps.

VIDEO TUTORIAL: Force.com Design Patterns, Part 2

Opportunity Stages

Opportunity Stages (with their probability):

StageFields
New (10%)Application Submitted, Amount, Needs Insurance, Needs Waiver, Adventure Cost
Needs Information (20%)Application Submitted, Needs Insurance, Needs Waiver
Negotiation (40%)Discount, Promo Code, Adventure Cost, Amount
Negotiation Rejected (40%)Discount, Adventure Cost, Amount
Awaiting Approval (60%) Discount, Adventure Cost, Amount
Deposit Made (70%) -
Scheduled (80%) -
Completed (100%) -
Cancelled (0%) -

About

☁️ A hands-on, deep yet quick introduction to Salesforce

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages