Import Accounts/Contacts

How to use Import Accounts/Contacts?

Import Account/Contacts help you to load Accounts/Contact from the setup menu

By using this you can import accounts and contacts at a time into the salesforce.

By using this  option you can load 50000 Account/Contact records.

By using this you cannot insert duplicate Account/Contact records.

By using this you can add accounts/Contacts into one sheet and you can load the records.

Here I will explain step by step procedure to import accounts.

Go to Setup -> Administer -> Data Management -> Click on Import Account/Contacts and click on Start the import Wizard. See the below screen for reference.


After clicking on Start impor wizard a new window will open. Click on Next

– choose your file to upload accounts and next

– Select your encoding and next select Contact matching type to identify duplicate records. and next

– Select Account Matching type to avoid duplicates.

– If want to trigger workflow rules for new and updated records then select the check box.

And click on NEXT. See the below screen for reference.


Map your csv file columns with contacts, see the below screen for reference.


And click on next and map additional custom fields and click on next and MAP account fields.

If you want override existing accounts check the “overwrite existing account values” check box. See the below screen for reference.

Import Acc 5

Click on NEXT and map additional account fields and click on NEXT. And again click on NEXT and click on Import Now button.

After clicking on import now button you will get message like below.


Click on FINISH button. You will get the mail confirmation when import is completed. In the email notification you will get message like below.


I think this will help you to load Accounts/Contacts. For more information see below references.

For any other clarifications please leave a comment.

Data import wizard in salesforce

Data import wizard in salesforce

Data import wizard provides you load the data into salesforce . By using this wizard we can insert, update & upsert the records.

By using this we can can import up to 50,000 records. It won’t allow you to load duplicate records.

By using this you can load Accounts, Contacts, Leads, Solutions and Custom objects.

Here i am posting how to use new data import wizard in salesforce.

To navigate data import wizard go to Setup -> Administer -> Data Management -> Data import Wizard and click on Launch Wizard.

See the below screen for reference.


After clicking on Launch Wizard you will navigate to Below Screen


Observe above screen here we have to do 3 steps to perform import operation.

1. What kind of data you are importing: Here you need to select object you want perform import operation.  Here you can select Accounts, Contacts, Leads, Solutions or any Custom object.

2. What do you want to do? : Here you need to specify which type of operation you are going to do ( Add new records, Update existing records, Add new and update existing records).

3. Where is your data located? : Here you need specify from where your loading data? i.e. you need to specify your csv file path

Now i am going to load data into any one of my custom object. In first step I have selected University object( one of my custom object) and selected and next in second step I have selected Add new records option. And finally in third step i have selected where exactly my csv file is located.

See the below screen to understand what i have done in 3 steps.


Once you are done above steps click on Next and map your CSV columns with salesforce fields. See the below screen for reference.

Wizard 5

Once your done with mapping click on next you will get review screen to review what you are going to do.

Wizard 6

After reviewing your selections click on Smart import button, you will get alert like below.

Wizard 7

Click on OK, then you screen will navigate bulk data load job page There you can monitor your job status. And also you can see the results also.

This wizard is simple to load the data up to 50000 records. Here i have given example to add new records only(insert). If you want you can update existing records (update) and also you can add and update exsting records(upsert).

Find more info here:

If you have any doubts on this leave your comment.

Salesforce Communities

Salesforce Communities:

Salesforce Communities are very useful for employees, customers and partners to connect in one place. We can create and customize communities according to our requirement. Communities was released in summer’ 13 release.

You can collaborate and communicate with people outside of your company who are key to business. We can easily communicate with internal users and portal users and external users.

We can create multiple communities in an organization. For example for partner support you can create one community and for customer support you create one more community. Like based on your business need you can create multiple communities.

Salesforce Communities are useful to:

–          Drive more sales by connecting your employees with your distributors, resellers, and suppliers

–           Deliver world-class service by giving your customers one place to get answers

–           Manage social listening, content, engagement, and workflow all in one place

Here in this post I will explain you how to enable community and how to create communities.

How to enable community in Salesforce?

To enable community in Salesforce go to setup -> Build -> Customize -> Communities and click on settings. and check enable communities check box and enter your domain name and save it.

Note: You cannot change your domain name once you save it. This domain name will be used in all of your communities.

See the below screen for reference.

Salesforce Communities

in the above screen Check availability button is used to, the domain entered by you is available or not.

Once communities is enabled new header will be enabled in your salesforce org, there you can swipe between multiple communities. See the below screen for reference.

Salesforce Communities

Now communities are enabled. We will see how to create communities.

How to create communities in salesforce?

To create communities go to setup -> Build -> Customize -> Communities -> Manage Communities -> and click on New communities button . And enter name, description and url and click on create button.

How to manage community?

Once community is created, that is only visible to only administrators until you publish it or share the URL. After creating the community you will navigate to following screen.

Salesforce Communities

Click on EDIT button to manage the community you just created. After clicking on edit you will be navigate to below screen.

Salesforce Communities

Members is used to add members to the community.

Tabs & pages button is used to manages Which tabs are available to the community and overriding home page with visualforce page.

Branding button is used add header, footer and to change colors.

Login Page button is used to add logo to your community and also we can define login options for external users.

Email button is used to specify sender email to notifications, chatter email branding and email templates.

Miscellaneous button is used to flagging contents, enable private messages and enable knowledgeable people on topics.

Once you defined all your community settings you can publish your community.

How to add members to your salesforce communities?

Based on the profiles and permission sets we can add members to the Salesforce communities.

To add members to your Salesforce communities go to Setup -> Build -> customize -> Community -> manage community -> and edit your community and click on Members and add profiles or permission sets you want give access to community.

See the below screen for reference.

Salesforce Communities

Opportunity Splits-Split credits across your team

Opportunity splits

Opportunity Splits allow you to allocate credits to multiple team members for an opportunity.

For example two members working on an opportunity, If you want to split credits of closed – won opportunity credits to both then we can uses opportunity splits.

Salesforce was released this feature in summer’ 13 and available in Enterprise, Performance, Unlimited and Developer editions.

Types of  Opportunity Splits: 

There are two types of opportunity splits those are Revenue Splits    and overlay splits

Revenue Splits: This type of splits allows you to allocate credits to team members/salesreps who are directly responsible for an opportunity. Use splits that total 100% of the opportunity amount.

Overlay Splits: This type of splits allows you to credit supporting (not directly responsible) team members, use splits that can total any percentage of the opportunity amount, including percentages over 100%.

How to enable Opportunity Splits

To enable opportunity splits first we have to enable Opportunity Teams ( Team Selling setup) after that we have to enable Opportunity splits.

1. Enable team selling:

To enable opportunity teams follow below instructions.

Setup -> Build -> Customize -> Opportunity Team -> click on settings ->enable team selling and save. See the below screen for reference.

Opportunity Splits


Next add Opportunity team related list to required opportunity page layouts and click on Save. See the below screen for reference.

Opportunity Splits


2. Enable opportunity Splits: 

To enable opportunity splits follow below instructions.

Setup -> Build -> Customize -> Opportunity Team -> click on Opportunity Split and click on set up opportunity splits. See the below screen for reference.

Opp Splits 3

After click on setup opportunity split button you will navigate to following screen

Split credits across your team


Select which type of split you are enabling for your organization and click on save. Next you will get below warning page.

Opp Splits 5

Click on enable. And next add opportunity Split related list to the required opportunity page layouts and click on save.

Opp Splits 6



Now opportunity split enabled to your organization.


Relationship Queries in salesforce

Relationship Queries

Using relationship queries, we can retrieve the related objects data using the SOQL query.

Parent-to-child and child-to-parent relationships exist between many types of objects, for example, Account is a parent of

Below diagram display relationship between Account and Contact.


To be able to traverse these relationships for standard objects, a relationship name is given to each relationship. The form of
the name is different, depending on the direction of the relationship:

child-to-parent relationship:

For child-to-parent relationships, the relationship name to the parent is the name of the foreign key, and there is a
relationshipName property that holds the reference to the parent object. For example, the Contact child object has a
child-to-parent relationship to the Account object, so the value of relationshipName in Contact is Account. These
relationships are traversed by specifying the parent using dot notation in the query, for example:

In the child to parent relationship, we can query on contact and retrieves the values from account that is associated.

Contact c = [Select First Name, Last Name, Account.Name, Account.Industry from contact where id = ‘XXXXXXXX’];

System.debug(‘Account Name: ‘ + c.Account.Name);

System.debug(‘Industry:  ‘ + c.Account.Industry);

Parent-to-child relationship:

For parent-to-child relationships, the parent object has a name for the child relationship that is unique to the parent, the
plural of the child object name. For example, Account has child relationships to Assets, Cases, and Contacts among other objects, and has a relationshipName for each, Assets, Cases, and Contacts.These relationships can be traversed only in the SELECT clause, using a nested SOQL query. For example:

In the parent -to-child relation, we can query on the parent object and we will get details about child record.

Account a = [Select Name, (Select Contact.FirstName, Contact.LastName from Account.Contacts) from account where id = ‘XXXX’];
System.debug(‘Name:’+ );

SOQL (Salesforce object Query Language)


–  SOQL (Salesforce object Query Language) retrieves the records from the database by using “SELECT” keyword.

–  By using SOQL, we can know in which object or fields the data resides.

–  We can retrieve the data from single object or from multiple objects that are related to each other.

–  SOQL uses the SELECT statement combined with filtering statements to return sets of data, which may optionally be ordered:

                          SELECT one or more fields

                          FROM an object

                          WHERE filter statements and, optionally, results are ordered

SOQL query is enclosed between square brackets. The following query retrieves a record from database that has the name field value equal to “Airway”.

Account a = [Select ID, Name from Account where Name=’acc1′];

In the above query “a” variable stores the ID, Name of the all accounts with name “acc1”

–  SOQL statements evaluate to a list of SObject records, single SObject records or an integer for count method quires.

Querying Single SObject records: Below query gets single account record with given ID.

                 Account a = [Select Name from Account where ID=’XXXXXXXXXXXX’];

Querying List of Sobjects records: Following example is to display list of account.

// querying list of records and stores in list variable “acc”

List<Account>  acc = [Select Name from Account where industry = ‘education’];

System.debug(‘Size: ‘+acc.size());    // displays size of the list

for(Integer i=0; i<=acc.size();i++)


System.debug(‘Size: ‘+acc[i].Name);      // To display accounts stored in “acc”


Below query gets number of record in an object.

Integer i = [Select count() from Account where industry=’education’];

System.debug(‘Count: ‘ + i);

Editing related list name in page layouts

Editing related list name:

We can add child objects as related lists in page layouts. Here my requirement is i want to change related list name.

I have created two objects 1. Book (master object) 2. Library (child object).

I have added library as related list in book page layout and given related list name as library first time. Now i want to change related list name from “library” to “Available Store”

related list


In the above screen i want change above related list name from library to  “Available Store”

To change the related list name go to child object(library) detail page and go to the field related with master object(book) and edit the field

related list

Change the related list label Available Store from library and save.

related list


SObject Types (Salesforce Object Type)

SObject Types

Sobjects are standard or custom objects that stores record data in the database. There is also SObject datatype in apex that is the programmatic representation of these SObjects.

Developers referes to SObject and their fields by their API names.

                     EXAMPLE: Account a = new Account();

                                                Student__c stu = new Student__c();

“__c” represents custom object/field created by us. By using this “__c” we can differentiate standard object/field and custom object/field.

The following example creates a student with some initial values Name, age and email and assign it to a variable of type Student__c which is a SObject type also.

                 Example: Student­­__c st = new Student__c( Name = ‘Rus’ age = ‘20’ email = ‘’);

SObject variable are intilized to null, but can be assigned a valid object reference with the new operator.

EXAMPLE: Account a = new Account ( Name =’ acc1′ BillingCity = Washington);   OR                 

                                       Account a = new Account ();

                                      a.Name = Acc1;

                                       a.BillingCity = Washington;

Accessing SObject fields:

SObject fields can be accessed or changes with simple dot notation.

  Example: Account acc = new Account ();

                 a.Name = Airway;   //Access the account name field and assign it “Airway”

System generated fields such as created by or last modified by cannot be modified. If we try, the apex runtime engine generates an error.

Additionally, formula fields and values for other fields that are read only for the context user cannot be changed.

Accessing SObject fields through Relationships:

We can create a relationship between object in Salesforce. In Salesforce there are different type of relations available. To understand relationships in Salesforce see this artical Relationships in salesforce

sObject records represent relationships to other records with two fields: an ID and an address that points to a representation of the associated sObject. For example, the Contact sObject has both an AccountId field of type ID, and an Account field of type Account that points to the associated sObject record itself.

The ID field can be used to change the account with which the contact is associated, while the sObject reference field can be used to access data from the account. The reference field is only populated as the result of a SOQL or SOSL query (see note below).

For example, the following Apex code shows how an account and a contact can be associated with one another, and then how the contact can be used to modify a field on the account:


Account a = new Account (name = ‘acc123’);
Insert a; // inserting account record
Contact c = new Contact (LastName = ‘Vincent’);
c.AccountId = a.Id; //associating contact with the account.
Insert c;

//By using below query we can get the account name form contact number.

c = [Select Account.Name from Contact where Id =:];
System.debug(‘Acc name before update:’ + c.Account.Name); // debug log We can also update account from contact.
c.Account.Name = ‘acc123456’;
update c.Account;
System.debug(‘updates acc name’ +; // debug log

Primitive Data Types

Primitive Data Types

Here we have primitive data types such as Integer, Double, Long, Date, Date Time, String, ID, and Boolean etc..

– All primitive data types are passed by value, not by reference.

– All Apex variables, whether they are class member variables or number variables are initialized to null. Make sure that we initialize variables to appropriate values before using them.

Boolean: A value that can only be assigned true, false or null.

Example: Boolean is Active = True;

Date: A  value that indicates a particular day. Date value contain no information about time. Date value must always be created with a system static method.

Example: Date dt = Date.newInstance(2014, 06, 01);

Output is : 2014-06-01 00:00:00

Time and Date Time: Data types associated with dates and times along with Date data type. The time data types stores times( Year, month and day). The date time data type stores both dates and times.

Each of these classes has a newInstance method with which we can construct particular data and time values.

Example: Time t = Time.newInstance(11,30,3,3);

Output is: 11:30:03.003Z

– we can also create dates and times from the current clock.

Example 1: DateTime dt =;

Output is : 2014-06-01 06:29:20

Example 2: Date dt1 =;

Output is: 2014-06-01 00:00:00

– The date and time classes also have instance methods for converting from one format to another.

Time t =;

Output is: 12:15:01.975Z

– We can also manipulate the  values by using a range of instance methods.

Date dt =;
Date dt30 = dt.addDays(30);

Output is : dt value = 2014-06-01 00:00:00

dt1 Value = 2014-07-01 00:00:00

Integere: A 32 bit number that doesn’t include a decimal point. Integer has a minimum value 0f -2,147,483,648 and maximum value of  2,147,483,647.

Example: Integer i=1;

Long: A 64 bit number that does n’t includes a decimal point. Long has a minimum value of -2^63 and a maximum value of 2^63-1.

Example: Long L = 2145335687L;

Double: A 64 bit number that does n’t includes a decimal point. Long has a minimum value of -2^63 and a maximum value of 2^63-1.

Example: Double d=3.14159

Decimal: A number that includes a decimal point. Decimal is an arbitrary precision number. Currency fields are automatically assigned the type decimal.

Example: Decimal dec = 19.23

Null Variables: If we declare a variable and don’t initialize it with a value, it will be null. Null means the absence of a value. We can also assign null to any variable declared with primitive type.

Both of below statements result in a variable set to null.

Boolean x=null;

Decimal d;

String: Strings are set of  characters and are enclosed in single quotes. They store text values such as a name or an address.

   Example: String s1 = ‘Salesforce tutorial’

We can also create strings from the values of other types, such as dates, by using the string static method value of().

Apart from these primitive data types in salesforce we have Sobject types (Salesforce object).