salesforce basic development

38
SALESFORCE DEVELOPMENT - MOUSUMI CHATTERJEE - NAVEEN DHANARAJ

Upload: naveen-dhanaraj

Post on 15-Feb-2017

42 views

Category:

Internet


2 download

TRANSCRIPT

Page 1: Salesforce Basic Development

SALESFORCE DEVELOPMENT

- MOUSUMI CHATTERJEE - NAVEEN DHANARAJ

Page 2: Salesforce Basic Development

Agenda• Introduction• Apex• Architecture of Apex

• Collections• List• Set• map

• Query• SOQL• SOSL

• Test class• Visualforce Pages• Architecture of visualforce pages

Page 3: Salesforce Basic Development

Introduction:

Salesforce.com is Sales(CRM) and Service applications which were developed and running on the Force.com Platform.

Force.com is a platform where you can develop your own application

Page 4: Salesforce Basic Development

APEXWhat is Apex?• Strongly Typed object oriented programming language and running on Force.com Platform.• Apex is Easy to use, Multitenant Environment, Upgrades Automatically, Easy Testing, Versioned, Integrated.• Apex allows developement of business logics to get executed system events including button click related record updates and vf pages.

Page 5: Salesforce Basic Development

Why we use APEX?•  When we have complex business processes

that are unsupported by the existing functionality.• When this is the case, the Force.com

platform includes a number of ways for advanced administrators and developers to implement custom functionality. • These include Apex, Visualforce, and the

SOAP API.

Page 6: Salesforce Basic Development

Architecture of APEX

Page 7: Salesforce Basic Development

Datatype1.Primitive - Basically found in any other programming language eg. Boolean, decimal double , ID (any Id in salesforce .com).

2. sObjects - It refer to Salesforce object . Datatype very specific to Salesforce. It represents a row of data.

3.Collections:

Page 8: Salesforce Basic Development

sObject• Account a= new

Account(name=“Dw",Type="Customer-Type" , Industry="Technology");

Page 9: Salesforce Basic Development

sObject• Account a= new

Account(name=“Dw",Type="Customer-Type" , Industry="Technology");

• Account a = new Account( Select name, type, Industry where name="Dazeworks Technologies);

Page 10: Salesforce Basic Development

sObject Contact c= [Select email from Contact where

name = “Dazeworks"]

String e = c.email;if(e == null)delete c;

If Email is not there then record with contact name will be deleted.

Page 11: Salesforce Basic Development

Writing APEX ClassSetup Build Develop Apex Class New

Page 12: Salesforce Basic Development

COLLECTION

Page 13: Salesforce Basic Development

Collections• Collection work somewhat like array, except

their size can change dynamically.• Collection is an object that can hold

reference of other object or sObject.• Collection are more advanced in behavior

and have easy access methods .

Page 14: Salesforce Basic Development

Types of Collection•LIST

•SET

•MAP

They are collections used inAPEX.

Page 15: Salesforce Basic Development

LIST•<List> is a collection of records which is an ordered collection. •<List> can contain duplicate values.

Page 16: Salesforce Basic Development

ExampleList<String> animal= new List<String>("pig",

"earthworm", "chimpanzee", "panda");

• pig--0• earthworm--1• chimpanzee -2• panda ---3

String first_animal =animals.get(0);

It will return pig

Page 17: Salesforce Basic Development

SET•Set is a collection of unique, unordered primitive datatypes or sobjects.•Set does not contain duplicate values.

Page 18: Salesforce Basic Development

ExampleSet<Integer> s = new set<Integer>();

s.add(1); //adds an element to the setSystem.asserts(s.contains(1)); // Asserts

that the set contains an element

s.remove(1); removes an element

Page 19: Salesforce Basic Development

MAP•MAP is a collection of key-pair values.• The key is unique and can be of any data-type like String , sObjects. Pair-values can have duplicate values.

Page 20: Salesforce Basic Development

SOQL Query

•Salesforce Object Query Language(SOQL) is a query-only language , similar to SQL .

• It uses relationship for navigating data.

• This is main language used for data retrieval of a single sObjects.

Page 21: Salesforce Basic Development

SOQL Query

Page 22: Salesforce Basic Development

SOSL Query•Salesforce Object Search Language(SOSL) is a simple language for searching all multiple persisted objects simultaneously.

• A SOSL Query begins with the required FIND clause

Page 23: Salesforce Basic Development

SOSL Query

Page 24: Salesforce Basic Development

Difference B/w SOQL and SOSLSOQL SOSL

Retrieves the records from the database by using “SELECT” keyword.

Retrieves the records from the database by using the “FIND” keyword.

Using SOQL we can know in Which objects or fields the data resides.

Using SOSL, we don’t know in which object or field the data resides.

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

We can retrieve multiple objects and field values efficiently when the objects may or may not be related to each other

We can Query on only one object. We can query on multiple objects.

Total number of records retrieved by SOQL queries is 50,000

Total number of records retrieved by a single SOSL query is 2000

Page 25: Salesforce Basic Development

TEST CLASS

Page 26: Salesforce Basic Development

APEX Unit Test • There must be 75% test coverage to be able

to deploy apex code to your production organization.• Testing is key to ensuring the quality of any

application• Salesforce executes Apex Unit Tests of all

organization to ensure quality and that no existing behaviour has been altered for customers.

Page 27: Salesforce Basic Development

APEX Unit TestBelow is the test class for the APEX Example shown

Page 28: Salesforce Basic Development

Best Practice for Test Class

• Test class must start with @isTest annotation.• To deploy to production at-least 75% code

coverage is required.• System.debug statement are not counted as

a part of apex code limit.• Test method should static and no void return

type.• Test method and test classes are not counted

as a part of code limit.

Page 29: Salesforce Basic Development

Visualforce Page

Page 30: Salesforce Basic Development

Visualforce Page•Visualforce is a framework that allows developers to build sophisticated, custom user interfaces that can be hosted natively on the Force.com platform.•Maximum response size for a Visualforce page is less than 15Mb.•Maximum file size for a file uploaded using a Visualforce page is 10Mb.

Page 31: Salesforce Basic Development

When to use Visualforce?

Visualforce page is a tag based mark-up language to develop customised user interface in Salesforce.

Page 32: Salesforce Basic Development

Visualforce Architecture

Page 33: Salesforce Basic Development

Writing Visualforce Page

Language style: Tag Mark-up

Page override model: Assemble standard and custom components using Tags.

Performance

Required technical Skills:

HTML , XML , Bootstrap

Interaction with Apex

Direct, by binding to a custom controller

Page 34: Salesforce Basic Development

Example

Page 35: Salesforce Basic Development

Example contd…

Page 36: Salesforce Basic Development

Tags in Visualforce PageTags : Used for :

<apex:page/> Calls an action when the page is loaded.

<apex:Form/> Creates a BUTTON that calls an action .

<apex:pageBlock/> Creates a LINK that calls an action .

<apex:pageblocksection/>

Create a section within page block.

<apex:inputfield/> HTML input element for a value to a field on a Salesforce object.

<apex:outputfield/> A read-only display of a label and value for a field on a Salesforce object

Page 37: Salesforce Basic Development

Governor Limits• Apex runs in a multitenant environment, the

Apex run time engine strictly enforces a number of limits to ensure that runaway Apex does not monopolize shared resources.

Description LimitsTotal number of SOQL queries issued 100Total number of SOSL queries issued 20Total number of DML statements issued 150Total heap size 6MBTotal heap size for Batch Apex and future methods 12MBMaximum size of a Visualforce email template

1MB

Total number of records retrieved by a single SOSL query 200

Page 38: Salesforce Basic Development

THANK YOU