0% found this document useful (0 votes)
25 views61 pages

Salesforce

The document outlines a series of exercises aimed at creating and managing Salesforce applications, including setting up a developer account, working with standard and custom objects, importing and exporting data, and using the Force.com IDE. It provides step-by-step instructions for creating custom objects, fields, and relationships, as well as utilizing tools like the Data Import Wizard and Dataloader.io for data management. Additionally, it covers the installation of the Force.com IDE and the creation of projects within it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views61 pages

Salesforce

The document outlines a series of exercises aimed at creating and managing Salesforce applications, including setting up a developer account, working with standard and custom objects, importing and exporting data, and using the Force.com IDE. It provides step-by-step instructions for creating custom objects, fields, and relationships, as well as utilizing tools like the Data Import Wizard and Dataloader.io for data management. Additionally, it covers the installation of the Force.com IDE and the creation of projects within it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Program No.

: 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:

1. Go to the Salesforce Developer Edition signup page: https://developer.salesforce.com/signup


2. Fill out the form with your contact information and company information.
3. In the Username field, enter a username that is in the form of an email address. This username does
not have to be a real email address, but it must be unique and cannot be associated with another
Salesforce login credential.
4. Read and select the checkbox for the Master Subscription Agreement.
5. Enter the Captcha words shown and click Sign me up.
6. You will receive an email with a login link. Click the link and change your password.
7. Once you have logged in, you will be taken to the Salesforce Developer Console.
8. On the Salesforce Developer website, click on settings icon in the top right corner and select
"Developer Console" from the dropdown menu.
Program No.: 2

AIM: Exercise on Standard and custom objects, Relationship fields.

A) Creating custom object, field and inserting a record :

In Salesforce, we think about database tables as objects, we think about columns as


fields, and rows as records. So instead of an account spreadsheet or table, we have an
Account object with fields and a bunch of identically structured records.

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.

i. Create a Custom Object: Property

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 Setup, go to Object Manager | Property.


2. In the sidebar, click Fields & Relationships.
3. Notice that there are already some fields there.
4. There is a name field and some of the system fields we talked about earlier.
5. Click New in the top right.
6. For data type, select Currency.
7. Click Next.
8. Fill out the following:
1. Field Label: Price
2. Description: The listed sale price of the home.
9. Check the Required box.
10. Click Next, Next again, and then Save.
iii. Create a Record

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.

1) Create a Custom Object: Favorite

a) Click the Object Manager tab.


b) Click Create | Custom Object in the top-right corner.
c) For Label, enter Favorite.
d) For Plural Label, enter Favorites.
e) Check the box for Launch New Custom Tab Wizard after saving this custom
object.
f) Leave the rest of the values as default and click Save.
g) On the New Custom Object Tab page, click the Tab Style field and select a
style you like.
h) Click Next, Next, and Save.
2) Create a Lookup Relationship

a) From Setup, go to Object Manager | Favorite.


b) On the sidebar, click Fields & Relationships.
c) Click New.
d) Choose Lookup Relationship and click Next.
e) For Related To, choose Contact. For the purposes of DreamHouse, contacts
represent potential home buyers.
f) Click Next.
g) For Field Name, enter Contact, then click Next.
h) Click Next, Next, and Save.
3) Create a Master-Detail Relationship

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

1) Viewing relationships between objects

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.

2) Create an object with Schema Builder

a) In the left sidebar, click the Elements tab.


b) Click Object and drag it onto the canvas.
c) Enter information about your object. You can make it whatever you want!
d) Click Save.
3) Create fields with Schema Builder

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

AIM: Exercise on how to import and export data.

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.

1. Use the Data Import Wizard

A. Prepare a File for Import

a) Replace any instances of SF with San Francisco.


b) Replace any instances of Calif or Cali with CA.
c) Replace any inconsistent Rating values with equivalent picklist values
already present in Salesforce (Cold, Warm, Hot).
d) Save the file to your Desktop by clicking File and choosing Save As.
e) Name the file Lead Import.
f) In the Save as type picklist, choose to save as a CSV file.
g) Click Save, then close the file.

B. Launch the Data Import Wizard

a) Click the setup gear Setup icon and select Setup.


b) Enter Data Import Wizard in the Quick Find box, then select Data Import
Wizard.
c) Click Launch Wizard, then choose the data to import.
d) In the Standard Objects tab, under What kind of data are you importing? click
Leads.
e) Under Where is your data located? click CSV.
f) If you’re using the Chrome browser, click Choose File. If you are using
Firefox or Internet Explorer, click Browse.
g) Select the Lead Import.csv file from the Desktop and click Open. (Note: If
you can’t see the file, make sure All Files is selected from the dropdown
above the Open button in the file window.)
h) Click Next.
2. Use Dataloader.io to Export Data

A. Extract Data with Dataloader.io

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 :

a) Click the Data tab.


b) Click the Sort button.
c) Ensure Expand the selection option is selected on the Sort Warning pop-
up.
d) Click Sort.
e) Add a check next to My data has headers to ensure column headings are
not included in the sort.
f) Ensure the column sort by is populated with Name.
g) Click OK.
h) The spreadsheet should now be sorted by Account Name.
3. Use Dataloader.io to Update Data

A. Update Using Dataloader.io


a) Ensure the account-site file and the Account Exports file (from the previous
step) are open.
b) Copy and paste the contents of the Account Site column from the account-
site file into the blank Site column in the Accounts Export file.
c) Save the Accounts Export.csv file in CSV format with a different name.

Now your Updated Account Site Import file is ready to be updated using
Dataloader.io.

a) With Dataloader.io open, click NEW TASK and select IMPORT.


b) Select Update.
c) From the Object list, select Account.
d) Click Next.
e) Click Upload CSV.
f) Choose the Updated Account Site Import file from your desktop, and
click Open.
g) Ensure the data is mapping correctly to the existing data.
h) CSV mapped to current dataNote: If there are errors, they will be
prominently denoted.
i) Click Next.
j) Click Save & Run.
k) Click Run.
l) The data has been successfully updated when 11 successes, 0 errors is
displayed. The Dataloader.io window can now be closed.
B. View the Results
a) Click the App Launcher App Launcher Icon and select Sales.
b) Click the Accounts tab.
c) Click the List View Controls icon List View Controls Icon and select New
from the dropdown.
d) Enter Accounts Modified Today as the List Name.
e) Select Only I can see this list view.
f) Click Save.
g) Click Done.
h) Click Add Filter again and fill in the criteria
i) Click Done.
j) Click Save.
k) Note that the 11 accounts you updated today are listed and all now have
Account Sites listed.
Program No.:4

AIM: Exercise on install Force.com IDE and create projects.

The Force.com IDE was a widely used development environment for Salesforce applications

Step 1: Install Eclipse IDE

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) Open Eclipse IDE.


2) Go to "Help" > "Eclipse Marketplace" from the top menu.
3) In the search bar, type "Force.com IDE" and press Enter.
4) Click the "Go" button next to "Force.com IDE."
5) Click the "Install" button for the "Force.com IDE" plugin.
6) Follow the on-screen instructions to complete the installation. You may need to
restart Eclipse after installation.

Step 3: Configure Force.com IDE with Your Salesforce Org:

1) In Eclipse, go to "Window" > "Preferences" from the top menu.


2) Expand the "Force.com" section on the left panel.
3) Click on "Connection" and then click the "Add" button to add a new Salesforce
connection.
4) Enter your Salesforce credentials (username and password) and click "Test
Connection" to verify the connection.
5) If the connection test is successful, click "OK" to save the configuration.

Step 4: Create a New Project

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

AIM: Exercise on primitive data types, sObject, Enum and collections.

In relation to programming languages, object-oriented means that the code focuses on


describing objects. An object can be anything that has unique characteristics, such as a person, an
account, or even a flower. Before you can truly understand what object-oriented means, there are
two things that you need to understand: classes and objects.

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:

public class AccountHandler {


public static void insertAccount(Integer n){
List<Account> addAccounts = new List<Account>();
Integer counter=1;
while(counter<=n){
Account store = new Account();
store.Name = 'Acme Inc N ' + counter;
store.AccountNumber = 'A000n' + counter;
addAccounts.add(store);
System.debug(addAccounts);
counter = counter + 1;
System.debug('Counter Value after incrementing ' + counter);
}
System.debug('Size of Account List: ' + addAccounts.size() );
System.debug('Elements in Account List: ' + addAccounts);
insert addAccounts;
}
}
AccountHandler.AccountHandler(3);

Output:

2. Write an Apex Program to illustrate list methods.


Program:
public class ListMethods {
public static void ListMeth(){
List<Integer> l = new List<Integer>();
l.add(7);
l.add(49);
l.add(6);
l.add(36);
System.debug(l);
System.debug(l.size());
System.debug(l.isEmpty());
l.sort();
System.debug(l);
System.debug(l.indexOf(49));
l.clear();
System.debug(l.size());
}
}
Output:

3. Write an Apex Program to illustrate Set methods.


Program:
public class SetMethods {
public static void mySet(){
Set<Integer> s = new Set<Integer>();
s.add(7);
s.add(49);
s.add(6);
s.add(36);
System.debug(s);
system.debug(s.size());
System.debug(s.contains(50));
System.debug(s.isEmpty());
s.remove(36);
System.debug(s);
s.clear();
System.debug(s.size());
}
}
SetMethods.mySet();

Output:
4. Write an Apex Program illustrate map methods.
Program:

public class MapMeths {


public static void myMap(){
Map <String, String> m = new Map <String, String>();
m.put('a', 'abc');
m.put('b', 'bcd');
m.put('c', 'cde') ;
String result = m.get('b');
System.debug('The value is '+ result);
System.debug(m.size());
System.debug(m.values());
System.debug(m.containskey('b'));
m.clear();
System.debug(m.isEmpty());
}
}
MapMeths.myMap();
Output:

5. Write an Apex Program to demonstrate Enum.


Program:

public class EnumDemo {


public enum Branches {IT,CSE,AIML,DS}
public void display(){
Branches ob = Branches.IT;
System.debug('obj c value : '+ob);
}
}
EnumDemo e = new EnumDemo();
e.display();

Output:
Program No.6:

AIM: Exercise on control statements and looping statements

1. Write an Apex Program to check whether a number is even or odd.


Program:

public class EvenOrOdd {


public void checkNumber(Integer n){
if(math.mod(n,2)==0){
System.debug(n +'is Even');
}
else{
System.debug(n+ 'is Odd');
}
}
}
EvenOrOdd e = new EvenOrOdd();
e.checkNumber(9);
Output:

2. Write an Apex Program to perform arithmetic operations for given twonumbers.


Program:

public class ArithmeticOp {


public void Arithmetic(Integer a,Integer b,String op){
switch on op{
when 'add'{
System.debug(a+b);
}
when 'sub'{
System.debug(a-b);
}
when 'mul'{
System.debug(a*b);
}
when 'div'{
System.debug(a/b);
}
when else{
System.debug('Invalid operation');
}
}
}
}
ArithmeticOp op = new ArithmeticOp();
op.Arithmetic(9,2,'add');

Output:

3. Write an Apex Program to print the even numbers between givennumbers.

Program:

public class Display {


public void evenOdd(Integer n){

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:

public class SumOfDigits {


public void sum(Integer n){
Integer r,sum=0;
while(n>0){
r = math.mod(n,10);
n = n/10;
sum += r;
}
System.debug('sum of digits' +sum);
}
}
SumOfDigits ob = new SumOfDigits();
ob.sum(1911);

Output:

5. Write an Apex Program to state whether a given year is a leap year or not.Program:

public class LeapYear {


public void checkLY(Integer n){
if(math.mod(n,4)==0 || math.mod(n,400)==0){
System.debug(n +' is a Leap Year');
}
else{
System.debug(n +' is not a Leap year');
}
}
}
LeapYear ob = new LeapYear();
ob.checkLY(2020);
ob.checkLY(1999);
Output:
6. Write an apex program to check whether a given string is palindrome ornot.
Program:

public class Palindrome {


public void checkPalindrome(String s){
String t = s.reverse();
if(s==t){
System.debug(s +' is a palindrome');
}
else{
System.debug(s +' is not a palindrome');
}
}
}
Palindrome ob = new Palindrome();
ob.checkPalindrome('Madam');
ob.checkPalindrome('Sir');

Output:
PROGRAM NO.: 8

AIM: Exercise on creating Apex class.

1. Write an Apex Program to create a class name “Rectangle” with two methods to
calculate area and perimeter of given values.

public class Rectangle {


public static void Area(Integer l,Integer b){
System.debug('Area of rectangle is '+l*b);
}
public static void Perimeter(Integer l,Integer b){
System.debug('Perimeter of rectangle is '+2*(l+b)) ;
}
}
Rectangle.Area(10,20);
Rectangle.Perimeter(10,20);

OUTPUT:

2. Create an Apex class called StringArrayTest with a method generateStringArray


that returns a list of formatted strings. The length of the list is determined by an
integer parameter. Eg. if the input is 3, then the output should be ['Test 0', 'Test 1',
'Test 2']. Remember that in Apex, the index position of the first element in a list is
always 0.

public class StringArrayTest {


public static List<string> generateStringArray(Integer value){
List<String> myList = new List<String>();
Integer i=0;
while(i<value)
{
myList.add('Test '+i);
i+=1;
}
System.debug(myList);
return myList;
}
}
StringArrayTest.generateStringArray(3);

OUTPUT :
PROGRAM NO.: 8

AIM: Exercise on SOQL and SOSL Queries.

1. Create an Apex class that returns contacts based on incoming parameters.The


class hasa method accepting two strings. The method searches for contacts that have a
last name matching the first string and a mailing postal code matching the second. It
gets the ID and Name of those contacts and returns them.

public class ContactSearch {


public static List<Contact> searchForContacts(String lastName, String postalCode){
List<Contact> Contacts = [Select Id, Name from contact where LastName =: lastName
and MailingPostalCode =: postalCode];
return Contacts;
}
}
ContactSearch.searchForContacts('PVPSIT','520007');

2.Create an Apex class that returns both contacts and leads based on a parameter.

public class ContactAndLeadSearch {


public static List<List<sObject>> searchContactsAndLeads(String LastName){
List<List<sObject>> ContactLeadList = [Find :lastName IN ALL FIELDS
RETURNING Contact(Name),Lead(Name)];
return ContactLeadList;
}
}
Lead ob = new Lead();
ob.LastName = 'Smith';
ob.Company = 'pvpsit';
insert ob;
Contact ob1 = new Contact();
ob1.LastName = 'Smith'; insert
ob1;
ContactAndLeadSearch.searchContactsAndLeads('Smith');

OUTPUT:
PROGRAM NO.: 9

AIM: Exercise on working with Apex Triggers.

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.

trigger AccountAddressTrigger on Account (before insert, before update) { for


(Account a : Trigger.New) {
a.AccountNumber = '69874512';
if (a.Match_Billing_Address c == true && a.BillingPostalCode != null) {
a.ShippingPostalCode = a.BillingPostalCode;
}

System.debug('Account Name: ' + a.Name);


System.debug('Account Number: ' + a.AccountNumber);
System.debug('Billing Postal Code: ' + a.BillingPostalCode);
System.debug('Shipping Postal Code: ' + a.ShippingPostalCode);
}

Account acc = new Account(); acc.Name =


'Smith Account'; acc.Match_Billing_Address c
= true; acc.BillingPostalCode = '12345'; insert
acc;

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.

trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) { List<Task>


taskList = new List<Task>();
for(Opportunity opp : Trigger.new){
if(Trigger.isInsert){
if(opp.StageName == 'Closed Won'){
taskList.add(new Task(Subject = 'Follow Up Test Task', WhatId = opp.Id));
System.debug('Id' +opp.Id);

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;
}
}

Opportunity ob = new Opportunity();


ob.StageName = 'Closed Won'; ob.Name =
'PVPSIT';
ob.CloseDate = Date.valueOf('2023-10-10'); insert ob;
OUTPUT:
PROGRAM NO.: 10

AIM: Exercise on displaying data using Visualforce and Visualforce pages.

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:

2. Create a Visualforce page that shows a basic Contact record.

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:

3. Create a Visualforce page to insert a record in Contact object.

<apex:page standardController="Contact" recordSetVar="contacts">


<apex:pageBlock title="Contacts List">
<apex:pageBlockTable value="{! contacts}" var="ct">
<apex:column value="{! ct.FirstName}"/>
<apex:column value="{! ct.LastName}"/>
<apex:column value="{! ct.Email}"/>
<apex:column value="{! ct.Account.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

OUTPUT:
Program No.: 11

AIM: Practice components in Lightning component framework.

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:

2. Create a custom record page


Give users a customized view of accounts by creating a custom account record page.

1. Create a Lightning page:


a. Type: Record Page
b. Label: New Account Page
c. Object: Account
d. Template: Header and Right Sidebar
e. Developer Name: New_Account_Page
2. Add standard components to the page:
a. Highlights Panel
b. Twitter
c. Tabs
3. Update the Tabs component:
a. Add the Activity tab
b. Add a standard components to each tab:
i. Activity tab: Activities
ii. Details tab: Record Detail
iii. Related tab: Related Lists
4. Activate the page, assign it as the org default, and make it available to both desktop and
phone users.

Create a custom record page

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 .

15. Click Done.


16. Create an Activity tab.
17. Drag the Recent Items tab to the top of the Tabs list in the properties pane.
The Recent Items tab is now in the first position in the tabs component. You can click
around between the tabs, but nothing changes because the tabs don’t have any
components in them. They’re empty. Let’s fix that.
18. Select the Details tab.
19. Drag a Record Detail component right below the Details tab, into the
greenhighlighted area.
20. Add a Related Lists component to the Related tab, an Activities component to
theActivity tab, and the Recent Items component to the Recent Items tab.
21. Select the tabs component on the canvas, and in the properties pane, change the
orderof the tabs to: Details, Activity, Recent Items, then Related.
You can’t drag the tabs inside the component to move them around. You can only
adjust them in the properties pane.
22. Click Save, then Not Yet.

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

Create a Lightning app

Find the package ID starting with 04t and copy it to your clipboard.

2. Click the Install a Package tab.


3. Paste the package ID into the field.
4. Click Install.
5. Select Install for Admins Only then click Install.
6. If you see a pop-up asking you to approve third-party access, select Yes, grant access
tothese third-party websites and click Continue.
When your package or app is finished installing, you see a confirmation page and get anemail
to the address associated with your playground.
Output:
Program No.: 12

AIM: Exercise on creating sandbox and deployment strategies.

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.

Create a New Sandbox

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.

Profiles and Permission Sets


Creating a change set of your own, including profiles and permission
sets, requiresspecial considerations.

Authorize a Deployment Connection

As a security measure, any org accepting a change set must authorize a


connection toaccept that change set.
1. Log in to the org that you want to receive the inbound changes.
2. From Setup, enter Deployment Settings in the Quick Find
box, then selectDeployment Settings.
3. Click Edit next to the org from which you want to receive inbound change
sets.
4. Select Allow Inbound Changes and click Save.

Upload the Change Set

Now that the connection is authorized,


1. Log in to the org containing the outbound Change Set.
2. From Setup, enter Outbound Change Sets in the Quick Find
box, then selectOutbound Change Sets.
3. Find the change set to upload. In this case, it is the change
set LanguageTraining.
4. Click Upload and choose your target org.

You might also like