SlideShare a Scribd company logo
1 of 27
Development with Force.com




                  Luu Thanh Thuy

                  CWI Team
Agenda

- Overview of Force.com

-   Database

-   Business Logic

- User interface

- Integration




                www.exoplatform.com - Copyright 2012 eXo Platform   2
Overview of force.com


-Is part of Salesforce.com
-PaaS.
-Is free for developer
-Relational database
-Apex language . Its syntax is blend of Java and database
stored language.
-Force.com IDE




                www.exoplatform.com - Copyright 2012 eXo Platform   3
Database

-Objects : related to database tables. Contains custom and standard object.
-Logical, not Physical, Object
-Delegated Tuning and Operations
-Undelete Support
-Fields
-Unique Identifiers
-Validation rules
-Formula Fields

 Billable Revenue (Currency) = Week_Total_Hrs__c * Rate_Per_Hour__c
-Rich Data Types
-History tracking
-Relationships : one to one, one to many, many to many




                      www.exoplatform.com - Copyright 2012 eXo Platform       4
Query Language

-Force.com has two query langue: Salesforce Object Query Language (SOQL)
And Salesforce Object Search Language (SOSL)
  Select Name, Total_Billable_Revenue_Pending_Invoice__c
  From Proj__c
  where Invoiced__c= FALSE and Start_Date__c = LAST_QUARTER
  ORDER_BY Total_Billable_Revenue_Pending_Invoice__c DESC LIMIT 10

FIND ‘java*’ in all fields returning
Project__c, Resource__c, Assignment__c, Skill__c

-No Function in Column list
-Governor Limits




                      www.exoplatform.com - Copyright 2012 eXo Platform    5
Object creation




                  www.exoplatform.com - Copyright 2012 eXo Platform   6
Database security

Security architectures as a funnel




                      www.exoplatform.com - Copyright 2012 eXo Platform   7
Security Architecture




               www.exoplatform.com - Copyright 2012 eXo Platform   8
Implementing the Security Model

-1. Create Profiles

-2. Configure Field Accessibility

-3. Set Organization-Wide default

-4. Establish Role hierarchy

-5. Adding Sharing Rule




                      www.exoplatform.com - Copyright 2012 eXo Platform   9
Database security




              www.exoplatform.com - Copyright 2012 eXo Platform   10
Business Logic

-Force IDE
-Apex language basic
-Database trigger
-Debugging and Testing




                   www.exoplatform.com - Copyright 2012 eXo Platform   11
Database trigger

Triggers are Apex code working in concert with the Force.com database
engine, automatically invoked by Force.com when database records are
modified.Trigger code can perform any necessary processing on the modified
data before or after Force.com




                     www.exoplatform.com - Copyright 2012 eXo Platform       12
Business Logic

_Save points :Savepoints are markers indicating the state of the database at a
specific point in the execution of your Apex program.They allow the database to
be restored to a known state in case of error or any scenario requiring a reversal
of all DML operations performed since the savepoint.

void printRecordCount() {
System.debug([ SELECT COUNT() FROM Resource__c ] + ' records');
}
printRecordCount();
Savepoint sp = Database.setSavepoint();
delete [ SELECT Id FROM Resource__c ];
printRecordCount();
Database.rollback(sp);
printRecordCount();
Database.rollback(sp);
printRecordCount();



                      www.exoplatform.com - Copyright 2012 eXo Platform          13
Business Logic

_ Record Locking prevent updates by one program have been modified by a
second program running at the same time.The changes of the second program
are lost because the first program is operating with stale data.

Resource__c tim = [ SELECT Id, Hourly_Cost_Rate__c
FROM Resource__c
WHERE Name = 'Tim Barr' LIMIT 1
FOR UPDATE ];
tim.Hourly_Cost_Rate__c += 20;
update tim;




                    www.exoplatform.com - Copyright 2012 eXo Platform       14
Business Logic

The three ways to send email in Apex are the following:
1. SingleEmailMessage: Sends an email to up to ten receivers.The email addresses of
   receivers are provided as strings. A string containing HTML or plain text is used as the
   message body.

2. SingleEmailMessage with Template: Sends to up to ten receivers, but the unique
    identifiers of Contact, Lead, or User objects must be used instead of strings
to provide the receivers’ email addresses.The message body is constructed from a
template.Templates are globally available to an organization as defined by an administrator
or private to an individual user.Templates can include merge fields to
dynamically substitute field values from the receiver’s record and, optionally, field
values from an additional, related object.


3. MassEmailMessage: Behaves like a SingleEmailMessage with template but can
send email to up to 250 receivers in a single call.




                         www.exoplatform.com - Copyright 2012 eXo Platform                    15
User Interfaces




                  www.exoplatform.com - Copyright 2012 eXo Platform   16
User Interfaces

_Visualforce controller : Standard controller, custom controller, Controller
   extension
1. Standard controller :Every database object has a standard controller. Its name
   is simply the name of the object. The implement is already provided by
   Force.com
2. Custom controller : no default functionality and consisting entirely of custom
Apex code

3. Controller extension : extends the standard controller




                      www.exoplatform.com - Copyright 2012 eXo Platform        17
User Interfaces :Modular Visualforce

Visualforce provide several features developer can use to create modular, highly
   maintainable pages.

1. Static resources : reusable images, scripts, stylesheets and other static
   content can be stored in resources, available for embeding in all Visualforce
   pages in the Force.com organization
2. Inclusion the contents of one Visualforce page can be included in another
   page. A common use for this is page headers and footers

3. Composition : Composition allows one Visualforce page to serve as a
   template for another. The template specifies the static and dynamic portions of
   a page
4. Custom Visualforce components: developers define their own custom
   components, reusable in any page




                      www.exoplatform.com - Copyright 2012 eXo Platform            18
Batch Processing

Batch processing is used for processing data exceeding the governor limits of
triggers and controller, allow you keep the large, data-intensive processing task
within the platform, taking advantage of its close proximity to the data and
transactional integrity.
Some key concepts in Batch Apex
1.Scope : is the set of records that a Batch Apex process operates on. It can
consist of 1 record or up to 50 million records. Scope is expressed as a SOQL
statement
2. Batch job : a batch job is a Batch Apex program that have been submitted for
execution. Batch job run in background an can take many hours to complete the
jobs. Salesforce provide user interface for listing batch jobs and their status and
allow individual jobs to be canceled.
3. Transaction : is up to 200 records. When a batch job start, the scope is split
into a series of transactions.




                       www.exoplatform.com - Copyright 2012 eXo Platform              19
Batchable Interface

In order to execute Batch job, Apex class must inplement Batchable interface, the
    logic processing following method

1. Start : run a QueryLocatior or an Iterable that describes the scope of the batch
   job.
2. Execute: After execute start, Force splits the records set into sets of up to 200
   records and invokes your execute method repeatedly
3. Finish ; the finish method is invoked once at the end of a batch job. You could
   use this method tho clear up any working state or notify the user via email that
   the batch job is completed




                      www.exoplatform.com - Copyright 2012 eXo Platform           20
Example




          www.exoplatform.com - Copyright 2012 eXo Platform   21
Stateful Batch Apex

Batch apex is stateless by default, means for each execution of your execute
method, you receive a fresh copy of your object. If your batch process needs
information that is shared across the transactions, make the Batch Apex class
stateful by implementing Stateful inferface.




                      www.exoplatform.com - Copyright 2012 eXo Platform         22
Limit Of Batch Apex

1. The maximum heap size in Batch Apex is 6 MB
2. Calling out to external systems using the HTTP object or webservice methods
   a limited to one for each invocation of start,execute and finish
3. Transactions run under the same governor limits as any Apex code
4. The maximum number of queued or active batch jobs within an entire
   Salesforce organization is five




                     www.exoplatform.com - Copyright 2012 eXo Platform       23
Integration
_Force.com support both SOAP and REST (xml or json)
_Force provides five types of Web service APIs :
Enterprise, Partner, Metadata, Apex , and Delegated Authentication

_The Enterprise API provides a strongly typed representation of the objects in
your Force.com. When you redefine an object or add a new object, the WSDL is
automatically update. You need manually download
_ The Partner API is designed for independent software vendor. They cannot repy
on a single, static representation of standard and custom object. With the partner
API , you can write generic code to access any object in any Force.com
organization




                      www.exoplatform.com - Copyright 2012 eXo Platform         24
Generating Stub Code


Force advises that you use the Force.com Web Service Connector (WSC) with its
Web services . http://code.google.com/p/sfdc-wsc. Copy WSC jar and
enterprise.wsdl into same folder




                     www.exoplatform.com - Copyright 2012 eXo Platform     25
Custom web service

-Global class access modifier
-Web service method. These method must be static
-Supporting class : user-defined Apex class, inner and outer that are arguments
or return values for a Web services must be defined as global. Member variables
of these classes must be defined using webservice keyword
-No Overloading : overloading method result in a compile error
-Prohibited types : the Map, Set, Pattern , Matcher, Exception and Enum types
are not allowed in the arguments or return types of Apex Webservices




                     www.exoplatform.com - Copyright 2012 eXo Platform        26
www.exoplatform.com - Copyright 2012 eXo Platform   27

More Related Content

What's hot

Esm migrate to_corre_6.0c
Esm migrate to_corre_6.0cEsm migrate to_corre_6.0c
Esm migrate to_corre_6.0cProtect724v3
 
ESM_ServiceLayer_DevGuide_1.0.pdf
ESM_ServiceLayer_DevGuide_1.0.pdfESM_ServiceLayer_DevGuide_1.0.pdf
ESM_ServiceLayer_DevGuide_1.0.pdfProtect724v2
 
R12 d49656 gc10-apps dba 03
R12 d49656 gc10-apps dba 03R12 d49656 gc10-apps dba 03
R12 d49656 gc10-apps dba 03zeesniper
 
R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05zeesniper
 
R12 d49656 gc10-apps dba 08
R12 d49656 gc10-apps dba 08R12 d49656 gc10-apps dba 08
R12 d49656 gc10-apps dba 08zeesniper
 
R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10zeesniper
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4than sare
 
Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Protect724
 
Share point review qustions
Share point review qustionsShare point review qustions
Share point review qustionsthan sare
 
Obiee10 g to 11g upgrade
Obiee10 g to 11g upgradeObiee10 g to 11g upgrade
Obiee10 g to 11g upgradeAmit Sharma
 
SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3Ben Abdallah Helmi
 
R12 d49656 gc10-apps dba 02
R12 d49656 gc10-apps dba 02R12 d49656 gc10-apps dba 02
R12 d49656 gc10-apps dba 02zeesniper
 
Salesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineSalesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineCyrille Coeurjoly
 
SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3Ben Abdallah Helmi
 
Oracle ebs r12_architecture
Oracle ebs r12_architectureOracle ebs r12_architecture
Oracle ebs r12_architecturesrinivas sunkara
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
( 13 ) Office 2007 Coding With Excel And Excel Services
( 13 ) Office 2007   Coding With Excel And Excel Services( 13 ) Office 2007   Coding With Excel And Excel Services
( 13 ) Office 2007 Coding With Excel And Excel ServicesLiquidHub
 
Lunacloud's Compute RESTful API - Programmer's Guide
Lunacloud's Compute RESTful API - Programmer's GuideLunacloud's Compute RESTful API - Programmer's Guide
Lunacloud's Compute RESTful API - Programmer's GuideLunacloud
 
Epicor 10-architected-for-efficiency-whitepaper
Epicor 10-architected-for-efficiency-whitepaperEpicor 10-architected-for-efficiency-whitepaper
Epicor 10-architected-for-efficiency-whitepaperLe Quoc Vuong
 

What's hot (20)

Esm migrate to_corre_6.0c
Esm migrate to_corre_6.0cEsm migrate to_corre_6.0c
Esm migrate to_corre_6.0c
 
ESM_ServiceLayer_DevGuide_1.0.pdf
ESM_ServiceLayer_DevGuide_1.0.pdfESM_ServiceLayer_DevGuide_1.0.pdf
ESM_ServiceLayer_DevGuide_1.0.pdf
 
R12 d49656 gc10-apps dba 03
R12 d49656 gc10-apps dba 03R12 d49656 gc10-apps dba 03
R12 d49656 gc10-apps dba 03
 
R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05R12 d49656 gc10-apps dba 05
R12 d49656 gc10-apps dba 05
 
R12 d49656 gc10-apps dba 08
R12 d49656 gc10-apps dba 08R12 d49656 gc10-apps dba 08
R12 d49656 gc10-apps dba 08
 
R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
 
R12 architectural changes
R12 architectural changesR12 architectural changes
R12 architectural changes
 
Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0
 
Share point review qustions
Share point review qustionsShare point review qustions
Share point review qustions
 
Obiee10 g to 11g upgrade
Obiee10 g to 11g upgradeObiee10 g to 11g upgrade
Obiee10 g to 11g upgrade
 
SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3
 
R12 d49656 gc10-apps dba 02
R12 d49656 gc10-apps dba 02R12 d49656 gc10-apps dba 02
R12 d49656 gc10-apps dba 02
 
Salesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineSalesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command line
 
SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3
 
Oracle ebs r12_architecture
Oracle ebs r12_architectureOracle ebs r12_architecture
Oracle ebs r12_architecture
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
( 13 ) Office 2007 Coding With Excel And Excel Services
( 13 ) Office 2007   Coding With Excel And Excel Services( 13 ) Office 2007   Coding With Excel And Excel Services
( 13 ) Office 2007 Coding With Excel And Excel Services
 
Lunacloud's Compute RESTful API - Programmer's Guide
Lunacloud's Compute RESTful API - Programmer's GuideLunacloud's Compute RESTful API - Programmer's Guide
Lunacloud's Compute RESTful API - Programmer's Guide
 
Epicor 10-architected-for-efficiency-whitepaper
Epicor 10-architected-for-efficiency-whitepaperEpicor 10-architected-for-efficiency-whitepaper
Epicor 10-architected-for-efficiency-whitepaper
 

Viewers also liked (7)

Products
ProductsProducts
Products
 
Magento
MagentoMagento
Magento
 
Campañas de sensibilización
Campañas de sensibilizaciónCampañas de sensibilización
Campañas de sensibilización
 
Sintaksis 5
Sintaksis 5Sintaksis 5
Sintaksis 5
 
Congreso SEO 2012 Patrocinio
Congreso SEO 2012 PatrocinioCongreso SEO 2012 Patrocinio
Congreso SEO 2012 Patrocinio
 
Rendimiento Web WPO para SEO
Rendimiento Web WPO para SEORendimiento Web WPO para SEO
Rendimiento Web WPO para SEO
 
mhrod/mib admission brochure 2011-2013
mhrod/mib admission brochure 2011-2013mhrod/mib admission brochure 2011-2013
mhrod/mib admission brochure 2011-2013
 

Similar to Development withforce

Similar to Development withforce (20)

Salesforce
SalesforceSalesforce
Salesforce
 
Basic of Oracle Application
Basic of Oracle ApplicationBasic of Oracle Application
Basic of Oracle Application
 
Basic of oracle application Login steps
Basic of oracle application Login stepsBasic of oracle application Login steps
Basic of oracle application Login steps
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
Adobe Flex4
Adobe Flex4 Adobe Flex4
Adobe Flex4
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
 
Synopsis
SynopsisSynopsis
Synopsis
 
Introduction to apex
Introduction to apexIntroduction to apex
Introduction to apex
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
 
Php
PhpPhp
Php
 
MarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt frameworkMarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt framework
 
OpenERP Technical Memento V0.7.3
OpenERP Technical Memento V0.7.3OpenERP Technical Memento V0.7.3
OpenERP Technical Memento V0.7.3
 
As pnet
As pnetAs pnet
As pnet
 
Readme
ReadmeReadme
Readme
 
unit 3.docx
unit 3.docxunit 3.docx
unit 3.docx
 
Php Web Frameworks
Php Web FrameworksPhp Web Frameworks
Php Web Frameworks
 
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 201310 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
 
AtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMSAtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMS
 
Flex Rails Pres
Flex Rails PresFlex Rails Pres
Flex Rails Pres
 
Alfresco Architecture
Alfresco ArchitectureAlfresco Architecture
Alfresco Architecture
 

More from adm_exoplatform

More from adm_exoplatform (13)

E xo mobile_overview_best_practice_in_mobile_application_design
E xo mobile_overview_best_practice_in_mobile_application_designE xo mobile_overview_best_practice_in_mobile_application_design
E xo mobile_overview_best_practice_in_mobile_application_design
 
Advance jquery-plugin
Advance jquery-pluginAdvance jquery-plugin
Advance jquery-plugin
 
Hadoop
HadoopHadoop
Hadoop
 
Jquery ui
Jquery uiJquery ui
Jquery ui
 
Cmsms
CmsmsCmsms
Cmsms
 
Jquery
JqueryJquery
Jquery
 
Java application server in the cloud
Java application server in the cloudJava application server in the cloud
Java application server in the cloud
 
I os
I osI os
I os
 
Memory and runtime analysis
Memory and runtime analysisMemory and runtime analysis
Memory and runtime analysis
 
Jvm mbeans jmxtran
Jvm mbeans jmxtranJvm mbeans jmxtran
Jvm mbeans jmxtran
 
Git training
Git trainingGit training
Git training
 
Cluster mode and plf cluster
Cluster mode and plf clusterCluster mode and plf cluster
Cluster mode and plf cluster
 
Cluster mode and plf cluster
Cluster mode and plf clusterCluster mode and plf cluster
Cluster mode and plf cluster
 

Recently uploaded

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

Development withforce

  • 1. Development with Force.com Luu Thanh Thuy CWI Team
  • 2. Agenda - Overview of Force.com - Database - Business Logic - User interface - Integration www.exoplatform.com - Copyright 2012 eXo Platform 2
  • 3. Overview of force.com -Is part of Salesforce.com -PaaS. -Is free for developer -Relational database -Apex language . Its syntax is blend of Java and database stored language. -Force.com IDE www.exoplatform.com - Copyright 2012 eXo Platform 3
  • 4. Database -Objects : related to database tables. Contains custom and standard object. -Logical, not Physical, Object -Delegated Tuning and Operations -Undelete Support -Fields -Unique Identifiers -Validation rules -Formula Fields Billable Revenue (Currency) = Week_Total_Hrs__c * Rate_Per_Hour__c -Rich Data Types -History tracking -Relationships : one to one, one to many, many to many www.exoplatform.com - Copyright 2012 eXo Platform 4
  • 5. Query Language -Force.com has two query langue: Salesforce Object Query Language (SOQL) And Salesforce Object Search Language (SOSL) Select Name, Total_Billable_Revenue_Pending_Invoice__c From Proj__c where Invoiced__c= FALSE and Start_Date__c = LAST_QUARTER ORDER_BY Total_Billable_Revenue_Pending_Invoice__c DESC LIMIT 10 FIND ‘java*’ in all fields returning Project__c, Resource__c, Assignment__c, Skill__c -No Function in Column list -Governor Limits www.exoplatform.com - Copyright 2012 eXo Platform 5
  • 6. Object creation www.exoplatform.com - Copyright 2012 eXo Platform 6
  • 7. Database security Security architectures as a funnel www.exoplatform.com - Copyright 2012 eXo Platform 7
  • 8. Security Architecture www.exoplatform.com - Copyright 2012 eXo Platform 8
  • 9. Implementing the Security Model -1. Create Profiles -2. Configure Field Accessibility -3. Set Organization-Wide default -4. Establish Role hierarchy -5. Adding Sharing Rule www.exoplatform.com - Copyright 2012 eXo Platform 9
  • 10. Database security www.exoplatform.com - Copyright 2012 eXo Platform 10
  • 11. Business Logic -Force IDE -Apex language basic -Database trigger -Debugging and Testing www.exoplatform.com - Copyright 2012 eXo Platform 11
  • 12. Database trigger Triggers are Apex code working in concert with the Force.com database engine, automatically invoked by Force.com when database records are modified.Trigger code can perform any necessary processing on the modified data before or after Force.com www.exoplatform.com - Copyright 2012 eXo Platform 12
  • 13. Business Logic _Save points :Savepoints are markers indicating the state of the database at a specific point in the execution of your Apex program.They allow the database to be restored to a known state in case of error or any scenario requiring a reversal of all DML operations performed since the savepoint. void printRecordCount() { System.debug([ SELECT COUNT() FROM Resource__c ] + ' records'); } printRecordCount(); Savepoint sp = Database.setSavepoint(); delete [ SELECT Id FROM Resource__c ]; printRecordCount(); Database.rollback(sp); printRecordCount(); Database.rollback(sp); printRecordCount(); www.exoplatform.com - Copyright 2012 eXo Platform 13
  • 14. Business Logic _ Record Locking prevent updates by one program have been modified by a second program running at the same time.The changes of the second program are lost because the first program is operating with stale data. Resource__c tim = [ SELECT Id, Hourly_Cost_Rate__c FROM Resource__c WHERE Name = 'Tim Barr' LIMIT 1 FOR UPDATE ]; tim.Hourly_Cost_Rate__c += 20; update tim; www.exoplatform.com - Copyright 2012 eXo Platform 14
  • 15. Business Logic The three ways to send email in Apex are the following: 1. SingleEmailMessage: Sends an email to up to ten receivers.The email addresses of receivers are provided as strings. A string containing HTML or plain text is used as the message body. 2. SingleEmailMessage with Template: Sends to up to ten receivers, but the unique identifiers of Contact, Lead, or User objects must be used instead of strings to provide the receivers’ email addresses.The message body is constructed from a template.Templates are globally available to an organization as defined by an administrator or private to an individual user.Templates can include merge fields to dynamically substitute field values from the receiver’s record and, optionally, field values from an additional, related object. 3. MassEmailMessage: Behaves like a SingleEmailMessage with template but can send email to up to 250 receivers in a single call. www.exoplatform.com - Copyright 2012 eXo Platform 15
  • 16. User Interfaces www.exoplatform.com - Copyright 2012 eXo Platform 16
  • 17. User Interfaces _Visualforce controller : Standard controller, custom controller, Controller extension 1. Standard controller :Every database object has a standard controller. Its name is simply the name of the object. The implement is already provided by Force.com 2. Custom controller : no default functionality and consisting entirely of custom Apex code 3. Controller extension : extends the standard controller www.exoplatform.com - Copyright 2012 eXo Platform 17
  • 18. User Interfaces :Modular Visualforce Visualforce provide several features developer can use to create modular, highly maintainable pages. 1. Static resources : reusable images, scripts, stylesheets and other static content can be stored in resources, available for embeding in all Visualforce pages in the Force.com organization 2. Inclusion the contents of one Visualforce page can be included in another page. A common use for this is page headers and footers 3. Composition : Composition allows one Visualforce page to serve as a template for another. The template specifies the static and dynamic portions of a page 4. Custom Visualforce components: developers define their own custom components, reusable in any page www.exoplatform.com - Copyright 2012 eXo Platform 18
  • 19. Batch Processing Batch processing is used for processing data exceeding the governor limits of triggers and controller, allow you keep the large, data-intensive processing task within the platform, taking advantage of its close proximity to the data and transactional integrity. Some key concepts in Batch Apex 1.Scope : is the set of records that a Batch Apex process operates on. It can consist of 1 record or up to 50 million records. Scope is expressed as a SOQL statement 2. Batch job : a batch job is a Batch Apex program that have been submitted for execution. Batch job run in background an can take many hours to complete the jobs. Salesforce provide user interface for listing batch jobs and their status and allow individual jobs to be canceled. 3. Transaction : is up to 200 records. When a batch job start, the scope is split into a series of transactions. www.exoplatform.com - Copyright 2012 eXo Platform 19
  • 20. Batchable Interface In order to execute Batch job, Apex class must inplement Batchable interface, the logic processing following method 1. Start : run a QueryLocatior or an Iterable that describes the scope of the batch job. 2. Execute: After execute start, Force splits the records set into sets of up to 200 records and invokes your execute method repeatedly 3. Finish ; the finish method is invoked once at the end of a batch job. You could use this method tho clear up any working state or notify the user via email that the batch job is completed www.exoplatform.com - Copyright 2012 eXo Platform 20
  • 21. Example www.exoplatform.com - Copyright 2012 eXo Platform 21
  • 22. Stateful Batch Apex Batch apex is stateless by default, means for each execution of your execute method, you receive a fresh copy of your object. If your batch process needs information that is shared across the transactions, make the Batch Apex class stateful by implementing Stateful inferface. www.exoplatform.com - Copyright 2012 eXo Platform 22
  • 23. Limit Of Batch Apex 1. The maximum heap size in Batch Apex is 6 MB 2. Calling out to external systems using the HTTP object or webservice methods a limited to one for each invocation of start,execute and finish 3. Transactions run under the same governor limits as any Apex code 4. The maximum number of queued or active batch jobs within an entire Salesforce organization is five www.exoplatform.com - Copyright 2012 eXo Platform 23
  • 24. Integration _Force.com support both SOAP and REST (xml or json) _Force provides five types of Web service APIs : Enterprise, Partner, Metadata, Apex , and Delegated Authentication _The Enterprise API provides a strongly typed representation of the objects in your Force.com. When you redefine an object or add a new object, the WSDL is automatically update. You need manually download _ The Partner API is designed for independent software vendor. They cannot repy on a single, static representation of standard and custom object. With the partner API , you can write generic code to access any object in any Force.com organization www.exoplatform.com - Copyright 2012 eXo Platform 24
  • 25. Generating Stub Code Force advises that you use the Force.com Web Service Connector (WSC) with its Web services . http://code.google.com/p/sfdc-wsc. Copy WSC jar and enterprise.wsdl into same folder www.exoplatform.com - Copyright 2012 eXo Platform 25
  • 26. Custom web service -Global class access modifier -Web service method. These method must be static -Supporting class : user-defined Apex class, inner and outer that are arguments or return values for a Web services must be defined as global. Member variables of these classes must be defined using webservice keyword -No Overloading : overloading method result in a compile error -Prohibited types : the Map, Set, Pattern , Matcher, Exception and Enum types are not allowed in the arguments or return types of Apex Webservices www.exoplatform.com - Copyright 2012 eXo Platform 26
  • 27. www.exoplatform.com - Copyright 2012 eXo Platform 27