Salesforce
Salesforce
: 1
AIM: Create, setup Salesforce developer account and access developer console.
The Developer Console is a powerful tool that allows you to develop and test Salesforce
applications. You can use the Developer Console to create new Salesforce objects, fields, and
relationships. You can also use the Developer Console to create and deploy Salesforce Apex and
Visualforce code.
The Developer Console is free of cost. You can create a Salesforce Developer Edition
account and access the Developer Console for free. The Developer Edition account gives you access
to a fully functional Salesforce instance that you can use to develop and test Salesforce applications.
Here are the steps on how to create a Salesforce Developer Edition account:
Salesforce supports several different types of objects. There are standard objects, custom
objects, external objects, platform events, and BigObjects. In this module, we focus on the
two most common types of objects: standard and custom.
Standard objects are objects that are included with Salesforce. Common business objects
like Account, Contact, Lead, and Opportunity are all standard objects.
Custom objects are objects that you create to store information that is specific to your
company or industry. For DreamHouse, D’Angelo wants to build a custom Property object
that stores information about the homes his company is selling.
1. Scroll to the bottom of this page and create a trailhead playground. Don’t
skip this step! You need to use a fresh and clean Trailhead Playground for
this module.
2. Once your playground is created (it takes a minute!), press Launch.
3. Click the gear icon at the top of the page and launch setup.
4. Click the Object Manager tab.
5. Click Create | Custom Object in the top-right corner.
6. For Label, enter Property. Notice that the Object Name and Record Name
fields auto-fill.
7. For Plural Label, enter Properties.
8. Prior to saving the custom object, scroll to the bottom of the page and select
the checkbox Launch New Custom Tab Wizard after saving this custom
object.
9. Leave the rest of the values as default and click Save.
10. On the New Custom Object Tab page, click the Tab Style field and select a
style you like. The style sets the icon to display in the UI for the object.
11. Click Next, Next, and Save.
ii. Create a Custom Field: Price on Property
1. From the App Launcher (The App Launcher icon in the navigation bar), find and
select Sales.
2. Click the Properties tab in the navigation bar. If you do not see it, look under the
More dropdown.
3. Click New in the top corner.
4. Enter a name and price for the property and click Save.
B) Create Object Relationships :
Now that we are comfortable with objects and fields, it is time to take things to the next
level with object relationships. Object relationships are a special field type that connects two objects
together.
Let’s think about a standard object like Account. If a sales rep opens an account, they have
probably been talking to a few people at that account’s company. They have probably made contacts
like executives or IT managers and stored those contacts’ information in Salesforce.
a) On the Object Manager page for the custom object, click Fields &
Relationships.
b) Click New.
c) Select Master-Detail Relationship and click Next.
d) For Related To, choose Property.
e) Click Next.
f) For Field Name, enter Property and click Next.
g) Click Next, Next, and Save.
4) Add a Favorite Property
a) From the App Launcher (The App Launcher icon. in the navigation bar), find
and select Sales.
b) Click the Properties tab in the navigation bar. If you don’t see it, look under
the More dropdown.
c) Click the name of a Property record.
d) Click Related. You’ll see Favorites (0) in the related tab.
e) Click New.
f) Enter a name for Favorite Name, then click Save.
C) Work with Schema Builder
a) From Setup, search for and click Schema Builder in the Quick Find box.
Quick Find box location.
b) In the left panel, click Clear All.
c) Check Contact, Favorite, Offer, and Property. You should have the Favorite
object from the previous unit, and the Offer and Property objects from the
previous challenges.
d) Click Auto-Layout.
a) From the Elements tab, choose a field type and drag it onto the object you
just created. Notice that you can create relationship fields, formula fields, and
normal fields in Schema Builder.
b) Fill out the details about your new field.
c) Click Save.
Program No.: 3
Having the knowledge to deal with data efficiently is part of what makes an admin awesome.
Your team relies on you to add and update records as they collect data on new accounts, leads,
opportunities, and more. And the faster you can get it done, the faster they can make their sales.
When you’re talking about more than a few records, entering or updating one by one just doesn’t
cut it. That process is slow and allows room for error (because even the awesomest of admins makes
a typo here and there). In this project, you use tools that allow you to upload and update many
records at a time, getting the job done quickly and with less effort than doing it manually. If you
haven’t used these tools before, it’s like climbing off your moped and taking a spin in a sports car.
a) From Setup, enter Dataloader.io in the Quick Find box, then select
Dataloader.io.
b) Click Launch dataloader.io.
c) Click the Confirm button.
d) Click Login with Salesforce.
e) Click Login.
f) If necessary, click Allow.
g) Click NEW TASK and select EXPORT.
h) dataloader.io new task menu
i) Leave the Connection selection as is and select Account from the Object list.
j) Click Next.
k) From the Fields menu, select Account ID, Account Name, and Account Site
from the Account options.
l) Account fields selected
m) Click SOQL Query to expand the menu.
n) To complete the where clause to your query, copy and paste: WHERE Type
LIKE '%Customer%'in the text box so your query looks like this:
o) Select Id, Name, Site FROM Account WHERE Type LIKE '%Customer%'
p) Note: Make sure there is a single space between Account and WHERE.
q) Completed Account queryNote: If an Oops! pop-up opens, click Close.
r) Click Next.
s) Click Save & Run.
Next, export the extracted records to a CSV file and view it in Excel or Numbers.
a) Click 11 successes next to the Task Run number. The CSV file should
now be downloaded.
b) Open the CSV file in either Excel or Numbers.
c) Leave the Dataloader.io browser tab open while viewing the file.
d) Sort the account name column A-Z and save the file
Instructions to sort :
Now your Updated Account Site Import file is ready to be updated using
Dataloader.io.
The Force.com IDE was a widely used development environment for Salesforce applications
The Force.com IDE is an Eclipse plugin, so you'll need to install Eclipse first. Visit the
Eclipse website (https://www.eclipse.org/downloads/) and download the appropriate Eclipse IDE
for your operating system.
Step 2: Install Force.com IDE Plugin Once Eclipse is installed, follow these steps to install the
Force.com IDE plugin:
1) In Eclipse, go to "File" > "New" > "Project" from the top menu.
2) In the "New Project" wizard, expand "Force.com" and select "Force.com Project."
3) Click "Next" to continue.
4) Choose the connection you configured in Step 3 from the dropdown menu.
5) Enter a project name and choose the metadata components you want to include in
your project.
6) Click "Finish" to create the project.
Program No.: 5
A class is a blueprint. Objects are based on classes. A class defines a set of characteristics
and behaviors that are common to all objects of that class. Classes are declared using four parts: the
access modifier, the keyword "class", the class name, and the class body. The body (inside the curly
braces { } ), is where methods and variables of the class are defined.
sObjects :
An sObject is an Apex data type that corresponds to a Salesforce object (sObject) in an org.
sObjects are complex data types that hold multiple values in one variable. They hold a single record
of data from a Salesforce object, such as an Account, a Contact, or an Opportunity.An object's fields
in an org are called sObject properties in Apex code. As each field in an org's object has a data type,
each sObject property has a data type.
Set :
A set is an unordered set of unique items of the same type. Similar to a list, a set is a group
of items, called elements, and all elements have the same data type, such as string, integer, or even
Account. Unlike a list, a set maintains no particular order for its elements. Because the elements are
unordered, a set can't have any duplicates.
Map :
A map is a more complex collection than either a list or a set. Each item in a map has two
parts: a key and a value, known as a key-value pair. Keys and values can be any data type. Although
each key is unique, values can be repeated within a map.
1. Write an Apex Program to demonstrate
sObject.Program:
Output:
Output:
4. Write an Apex Program illustrate map methods.
Program:
Output:
Program No.6:
Output:
Program:
if(math.mod(n,2)==0){
Integer i=2;
while(i<=n){
System.debug(i);
i+=2;
}
}
else{
Integer i = 1;
while(i<=n){
System.debug(i);
i+=2;
}
}
}
}
Display ob = new Display();
ob.evenOdd(5);
ob.evenOdd(10);
Output:
4. Write an Apex Program to find the sum of digits of a given number.
Program:
Output:
5. Write an Apex Program to state whether a given year is a leap year or not.Program:
Output:
PROGRAM NO.: 8
1. Write an Apex Program to create a class name “Rectangle” with two methods to
calculate area and perimeter of given values.
OUTPUT:
OUTPUT :
PROGRAM NO.: 8
2.Create an Apex class that returns both contacts and leads based on a parameter.
OUTPUT:
PROGRAM NO.: 9
1. Create an Apex trigger that sets an account’s Shipping Postal Code to match the
Billing Postal Code if the Match Billing Address option is selected. Fire the trigger before
inserting an account or updating an account.
OUTPUT:
2. Create a bulkified Apex trigger that adds a follow-up task to an opportunity if its
stage is Closed Won. Fire the Apex trigger after inserting or updating an opportunity.
if(Trigger.isUpdate){
if(opp.StageName == 'Closed Won' && opp.StageName !=
Trigger.oldMap.get(opp.Id).StageName){
taskList.add(new Task(subject = 'Follow Up Test Task', WhatId = opp.Id));
System.debug('Id' +opp.Id);
}
if(taskList.size()>0){ insert
taskList;
}
}
1. Design a simple user interface to input data using forms in Visualforce Pages.
Class:
public class Example1 {
public String name;
public String getName(){
return name;
}
public void SetName(String name){
this.name = name;
}
}
VisualForce Page:
<apex:page controller="Example1">
<apex:form >
<apex:outputLabel >Enter Name</apex:outputLabel>
<apex:inputText value="{!name}"/>
<apex:commandButton value="click" reRender="one"/>
<apex:outputLabel id="one">your name is {!name}</apex:outputLabel>
</apex:form>
</apex:page>
OUTPUT:
apex:page standardController="Contact">
<apex:form >
<apex:pageBlock title="Add contacts">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Contact.FirstName}"/>
<apex:inputField value="{!Contact.LastName}"/>
<apex:inputField value="{!Contact.email}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
OUTPUT:
OUTPUT:
Program No.: 11
1. Create a custom home page that includes a quarterly performance summary and important
updates on critical tasks and opportunities.
Create a Custom Home Page for Lightning Experience
1. From Setup, enter App Builder in the Quick Find box, then click Lightning App
Builder.
2. Click New, select Home Page, then click Next.
3. Step through the wizard and name the page New Home Page, select the Standard
Home Page template, and then click Done.
4. An empty Home page opens, ready for you to build it. The components pane contains
all the standard components available for a Home page, plus any custom components
you have installed in your org.
5. Drag the Assistant component to the top-right region.
6. Drag Performance to the top-left region.
7. Add Today’s Events to the lower left region and add Key Deals to the lower right
region.
8. Add Today’s Tasks above the Assistant.
Click Save.
9. Click Activate, and we’ll do just that.
If you saved previously and didn’t activate the page, you can click the Activation
button in the toolbar to be ready for the next section.
OUTPUT:
1. From Setup, enter App in the Quick Find box, then select Lightning App
Builder
Builder.
2. Click New.
3. Select Record Page and start stepping through the wizard.
4. Name your page New Opportunity Page , and select Opportunity.
Start typing an object’s name in the Object field to filter the list and find what you’re
looking for more quickly.
5. Choose the Header, Subheader, Right Sidebar template, and click Done.
In the components pane, you see all the standard components available for
opportunity record pages and any custom components that you’ve installed in your
org.
6. From the settings menu ( ), select Always show icons.
The icons that appear in the palette show what form factors each component supports.
For example, if you add the Chatter Feed component to your page, it displays when
you view the page on both a desktop and in the Salesforce mobile app. The same is
not true for Chatter Publisher, which is supported on desktop only. We’ll see this
behavior in action when we test our finished page.
7. Drag the Highlights Panel component into the top region of the page. Click See How
It Works in the component properties pane to find out where the highlights panel
content comes from.
8. Add the Path component to the region below the highlights panel.
9. Add a Chatter component to the lower right region.
10. Add a Tabs component to the lower left region
11. The Tabs component comes with some default tabs already in place. Let’s add more.
12. In the Tabs component details pane, click Add Tab.
By default, another Details tab is added. But because we already have one, let’s
change this new one to something else.
13. Click the second Details tab.
14. From the Tab Label dropdown menu, select Custom, and give the tab a
newlabel: Recent Items .
Output:
3. Create a Lightning app using standard components
To easily organize and access key data, create a Lightning app that uses standard components.
a. Create a Lightning app page:
i. Type: App Page
ii. Label: MyData
iii. Template: One Region
iv. Developer Name: MyData
b. Add the Recent Items standard component:
i. Label: Recent Items
ii. Objects:
1. Account
2. Contact
3. Lead
c. Activate the app:
i. Select Activate for All Users
ii. Add the app to the Mobile Navigation Menu
Create a Lightning app
1. From Setup, enter App in the Quick Find box, then select Lightning App
Builder
Builder.
2. Click New.
3. Select App Page, and then click Next.
4. Name your Lightning page Top Accounts and Opportunities .
5. Select the Two Regions template, and click Done.
If the Lightning App Builder walkthrough pops up, dismiss it.
6. Drag the List View component into the first region.
7. In the properties pane, select Account for the object, select the Platinum and Gold
SLA Customers filter, and set the number of records to display to 5.
8. Add a Recent Items component into the second region.
9. In the properties pane for the Recent Items component, click Select and configure the
Selected list so it only contains Opportunity.
10. In the properties pane, click Page, click Select, and then add these actions to the page.
o Log a Call
o New Account
o New Opportunity
You can add only global actions to a Lightning app page.
11. From the toolbar, change the view to Tablet-Landscape.
12. Click Save, and then Not Yet.
Output:
4. Create a Lightning app using custom components
To easily organize and access your important contacts, create a Lightning app that uses
acustom component.
1. Install a package:
a. Package ID: 04t1a000000REQ2
2. Add the ContactsToday custom lightning component to your MyData
Lightningpage
Find the package ID starting with 04t and copy it to your clipboard.
1. Creating a Sandbox
A Salesforce sandbox is a place for you to test and build without risk of changing or
losing the valuable data in your main, or production, Salesforce org. Sandboxes are the
perfect tool for keeping your data clean during training, testing, and development.
There are four types of sandboxes, each suited for different tasks.
Let’s start by setting up a Developer sandbox. Note that you have to do these steps in
your Salesforce production environment—you can't set up a sandbox in a Trailhead
Playground or another Developer Edition org.
1. Go to Setup by clicking the gear icon ( ) in the navigation bar and then Setup.
2. From Setup, enter Sandboxes in the Quick Find box, then select Sandboxes. You
can see how many available sandbox licenses you have at the top of the page.
3. Click New Sandbox.
4. Enter a name and description for the sandbox. We recommend a name that describes
how you’ll use the sandbox and has only a few characters, like QA, Release,
or AppTesting.
5. You can also select if you want to create your sandbox from production or another
existing sandbox. You’ll usually select production unless you’d like to copy the
configurations from another sandbox, which may be helpful if you’re developing
an app and want to bring in objects you created there.
6. Select the type of sandbox you want to create and click Next. We’ll select Developer
here, but if you select a Partial Copy or Full sandbox, you will also haveto select a
sandbox template to specify what data you would like to use to populate your
sandbox. (Check out Create or Edit Sandbox Templates in Resources for details.)
If you don’t see a sandbox option or need licenses for more sandboxes, contact your
Salesforce Account Executive to order sandboxes for your org.
7. On the next screen, you can optionally specify a script to run after each creation or
refresh for the new sandbox by entering an Apex Class. We won’t add one in this
example.
8. Click Create.
2. Deployment strategies:
Create an Outbound Change Set
In his Developer sandbox, Calvin creates a new change set that he can migrate to the
Developer Pro sandbox. This change set contains any new and changed metadata
components from Calvin’s customization work. To successfully create the change set,
Calvin must include all components needed to make the customization work in the
target environment.
Calvin reviews a report in the change tracking tool and sees there are two sets of things
to add to the new outbound change set.
• The custom objects themselves
• The components supporting the custom objects he created
The new Language Course custom object has a Master-Detail relationship with the
Language Course Designer custom object. This means that Language Course
components have a dependency on Language Course Designer components. That
dependency means that Language Course components can’t exist in an org unless the
Language Course Designer components also exist in the org.
1. From Setup, enter Outbound Change Sets in the Quick Find box, then select
Outbound Change Sets.
2. Click New.
3. Enter a name for your change set and click Save. Calvin names the change set
Language Training.
4. In the Change Set Components section, click Add.
5. Choose the type of component, the components you want to add, and click Add
To Change Set. Calvin chooses Custom Object as the component type, selects both
Language Course and Language Course Designer, and clicks Add to Change Set.
6. Click View/Add Dependencies to see whether the components you’ve added to the
change set are dependent on other customizations.
7. Select the dependent components you want to add and click Add To Change Set.
Delete or Rename Components
Here’s something interesting: You can use a change set to add new
and changedcomponents, but you can't use change sets to delete or
rename components.
• To delete components, use the web interface in the target org.
• To rename a component, first delete the component in the target
org and thenupload the new component in a change set.