SlideShare a Scribd company logo
1 of 73
Advanced Developer
Workshop
Peter Chittum
Developer Evangelist
@pchittum
pchittum@salesforce.com
Hervé Maleville
Platform Architect
@hmaleville
herve.maleville@salesforce.com
Wifi Access
SSID: Guest
Password: fBSuBLqe
http://bit.ly/elevate_adv_workbook
Login and Get Ready
Be Interactive
Free Developer
Environment
http://developer.force.com/join
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking
statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions
proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-
looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any
projections of subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of
management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or
technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
functionality for our service, our new business model, our past operating losses, possible fluctuations in our operating results and
rate of growth, interruptions or delays in our Web hosting, breach of our security measures, risks associated with possible mergers
and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and
motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited
history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on
potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the
most recent fiscal quarter ended July 31, 2011. This document and others are available on the SEC Filings section of the Investor
Information section of our Web site.
Any unreleased services or features referenced in this or other press releases or public statements are not currently available and
may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon
features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-
looking statements.
Nos prochains évènements à Paris!
Salesforce1 Tour à Paris
Webinar en Français: Data Model & Relationships
Prenez le lead sur notre communauté de Développeurs en France !
Plus d‟information sur www.developer.salesforce.com
June
26th
April
29th
A vous
de jouer
Core
Services
Chatt
er
Multi-
langua
ge
Translati
on
Workben
ch
Email
Servic
es
Analyti
cs
Cloud
Databa
se
Schee
ma
Builder
Sear
ch
Visualfo
rce
Monitori
ng
Multi-
tenant
Ape
x
Data-
level
Securit
y
Workflo
ws
APIs
Mobile
Services
Soci
al
APIs
Analyti
cs
APIs
Bulk
APIs
Rest
APIs
Metada
ta
APIs
Soap
APIs
Private
App
Exchang
e
Custo
m
Action
s
Identi
ty
Mobile
Notificati
ons
Tooli
ng
APIs
Mobile
Packs
Mobile
SDK
Offline
Support
Streami
ng
APIs
Geolocat
ion
ET 1:1
ET
Fuel
Heroku1
Heroku
Add-
Ons
Sharin
g
Model
ET API
Salesforce1 Platform
Salesforce is a Platform Company. Period.
-Alex Williams, TechCrunch
600MAPI Calls
Per Day
6BLines of Apex
4M+Apps Built on
the Platform
72BRecords
Stored
Salesforce1 Platform
1.5 Million
Editor Of Choice
For the Eclipse fans in the room
Warehouse Application Requirements
 Track price and inventory on hand for all
merchandise
 Create invoices containing one or more
merchandise items as a line items
 Present total invoice amount and current
shipping status
Warehouse Data Model
Merchandise
Name Price Inventory
Pinot $20 15
Cabernet $30 10
Malbec $20 20
Zinfandel $10 50
Invoice
Number Status Count Total
INV-01 Shipped 16 $370
INV-02 New 20 $200
Invoice Line Items
Invoice Line Merchandise Units
Sold
Unit Price Value
INV-01 1 Pinot 1 15 $20
INV-01 2 Cabernet 5 10 $150
INV-01 3 Malbec 10 20 $200
INV-02 1 Pinot 20 50 $200
Apex
Introduction to Apex
 Object-Oriented Language
 Dot Notation Syntax
 Case Insenstive
 “First Class” Citizen on the Platform
Apex Anatomy
Chapter 1:
public with sharing class myControllerExtension implements Util {
private final Account acct;
public Contact newContact {get; set;}
public myControllerExtension(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord();
}
public PageReference associateNewContact(Id cid) {
newContact = [SELECT Id, Account from Contact WHERE Id =: cid LIMIT 1];
newContact.Account = acct;
update newContact;
}
}
Class and Interface based
Scoped Variables


Inline SOQL
Inline DML


Developer Console
 Browser Based IDE
 Create and Edit Classes
 Create and Edit Triggers
 Run Unit Tests
 Review Debug Logs
Apex Triggers
 Event Based Logic
 Associated with Object
Types
 Before or After:
 Insert
 Update
 Delete
 Undelete
Controlling Flow
trigger LineItemTrigger on Line_Item__c (before insert,
before update) {
//separate before and after
if(Trigger.isBefore) {
//separate events
if(Trigger.isInsert) {
System.debug(‘BEFORE INSERT’);
DelegateClass.performLogic(Trigger.new);
Static Flags
public with sharing class AccUpdatesControl {
// This class is used to prevent multiple calls
public static boolean calledOnce = false;
public static boolean ProdUpdateTrigger = false;
}
Chatter Triggers
trigger AddRegexTrigger on Blacklisted_Word__c (before insert, before update) {
for (Blacklisted_Word__c f : trigger.new)
{
if(f.Custom_Expression__c != NULL)
{
f.Word__c = '';
f.Match_Whole_Words_Only__c = false;
f.RegexValue__c = f.Custom_Expression__c;
}
}
}
Trigger Tutorial
 Basic: Tutorial 2
 Intermediate: Tutorial 4
 Beyond Intermediate: http://bit.ly/ELEV-triggers
http://bit.ly/elevate_adv_workbook
Unit Testing in Apex
 Built in support for testing
– Test Utility Class Annotation
– Test Method Annotation
– Test Data build up and tear down
 Unit test coverage is required
– Must have at least 75% of code covered
 Why is it required?
Unit Testing
• Declare Classes/Code as
Test
• isTest Annotation
• testmethod keyword
• Default data scope is test
only
Testing Context
// this is where the context of your test begins
Test.StartTest();
//execute future calls, batch apex, scheduled apex
// this is where the context ends
Text.StopTest();
System.assertEquals(a,b); //now begin assertions
Testing Permissions
//Set up user
User u1 = [SELECT Id FROM User WHERE Alias='auser'];
//Run As U1
System.RunAs(u1){
//do stuff only u1 can do
}
Static Resource Data
List<Invoice__c> invoices = Test.loadData(Invoice__c.sObjectType,
'InvoiceData');
update invoices;
Mock HTTP Endpoints
@isTest
global class MockHttp implements HttpCalloutMock {
global HTTPResponse respond(HTTPRequest req) {
// Create a fake response
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setBody('{"foo":"bar"}');
res.setStatusCode(200);
return res;
}
}
Mock HTTP Endpoints
@isTest
private class CalloutClassTest {
static void testCallout() {
Test.setMock(HttpCalloutMock.class, new MockHttp());
HttpResponse res = CalloutClass.getInfoFromExternalService();
// Verify response received contains fake values
String actualValue = res.getBody();
String expectedValue = '{"foo":"bar"}';
System.assertEquals(actualValue, expectedValue);
}
}
Unit Testing Tutorial
Batch Apex
Apex Batch Processing
 Governor Limits
– Various limitations around resource usage
 Asynchronous processing
– Send your job to a queue and we promise to run it
 Can be scheduled to run later
– Kind of like a chron job
Batchable Interface
global with sharing class WHUtil implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{ //Start on next context }
global void execute(Database.BatchableContext BC, List<sObject> scope)
{ //Execute on current scope }
global void finish(Database.BatchableContext BC)
{ //Finish and clean up context }
}
Implementing Apex Batch Processing
Apex Batch Processing Tutorial
Scheduled Apex
Schedulable Interface
global with sharing class WarehouseUtil implements Schedulable {
//General constructor
global WarehouseUtil() {}
//Scheduled execute
global void execute(SchedulableContext ctx) {
//Use static method for checking dated invoices
WarehouseUtil.checkForDatedInvoices();
}
}
Schedulable Interface
System.schedule('testSchedule','0 0 13 * * ?',
new WarehouseUtil());
Via Apex
Via Web UI
Unit Testing Batch Apex
Test.StartTest();
System.schedule(‘once','0 0 13 * * ?',new,WarehouseUtil());
ID batchprocessid = Database.executeBatch(new WarehouseUtil());
Test.StopTest();
Scheduling Apex
Apex Scheduling Tutorial
Apex REST Services
Apex REST
@RestResource(urlMapping='/CaseManagement/v1/*')
global with sharing class CaseMgmtService
{
@HttpPost
global static String attachPic() {
RestRequest req = RestContext.request;
RestResponse res = Restcontext.response;
Id caseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Blob picture = req.requestBody;
Attachment a = new Attachment (ParentId = caseId,
Body = picture,
ContentType = 'image/
Apex REST Services
REST Services with Apex Tutorial
Visualforce
Framework
 Server-side compiled web pages
– (Think PHP, JSP, etc.)
 Easily create salesforce UI
 Standard-compliant
 Can Interact With Apex for Custom Logic
Visualforce Tags
<apex:page docType=“html-5.0” />
<apex:input type=“email”/>
<apex:pageBlockSection collapsible=“false” />
Hashed information block to track server side transports
Viewstate
Apex Form
 Required for standard salesforce post
 Incurs Viewstate Overhead
<apex:form>
…
</apex:form
aspdoifuapknva894372h
4ofincao98vh0q938hfoq
iwnbdco8q73h0o9fqubov
ilbodfubqo3e8ufbw
Interacting with Apex
 ActionFunction allows direct binding of variables
 ActionFunction requires ViewState
 JavaScript Remoting binds to static methods
 JavaScript Remoting uses no ViewState
 Transient, Private and Static reduce Viewstate
Apex Remote Action
 Static
 No View State
 Invoked through JS API
 Invokes JS Callback
@remoteAction
global static String myMethod(String
inputParam){
...
}
Calling Apex Remote Action
Visualforce.remoting.Manager.invokeAction(’
{!$RemoteAction.RemoteClass.methodName}'
,
param,
function(result, event) {
//...callback to handle result
});
Event Object: Success Example
{
"statusCode":200,
"type":"rpc",
"ref":false,
"action":"IncidentReport",
"method":"createIncidentReport",
"result":"a072000000pt1ZLAAY",
"status":true
}
Event Object: Failure Example
{
"statusCode":400,
"type":"exception",
"action":"IncidentReport",
"method":"createIncidentReport",
"message":"List has more than 1 row for assignment to SObject",
"data": {"0":
{"Merchandise__c":"a052000000GUgYgAAL","Type__c":"Accident","Desc
ription__c":"This is an accident report"}},
"result":null,
"status":false
}
Interacting with the Publisher: Allow Submit
 Make Submit Active
 Payload true/false
Sfdc.canvas.publisher.publish(
{
name: "publisher.setValidForSubmit",
payload:true
});
Interacting with the Publisher: Subscribe to Submit
 Attach to Submit Event
Sfdc.canvas.publisher.subscribe({
name: "publisher.post",
onData:function(e) {
// This subscribe fires when the user hits 'Submit'
in the publisher
postToFeed();
}});
Interacting with the Publisher: Close Publisher
 Make the Submit Happen
Sfdc.canvas.publisher.publish({name:
"publisher.close", payload:
{ refresh:"true"}});
The Future! (Well, Spring „14)
Remote Objects
 Standard CRUD/Q functionality without Apex
 Similar to remoteTK or SObjectData
 Visualforce components define data models
<apex:jsSObjectBase shortcut="tickets">
<apex:jsSObjectModel name="Ticket__c" />
<apex:jsSObjectModel name="Contact" fields="Email" />
<script>
var contact = new tickets.Contact();
contact.retrieve({
where: {
Email: {
like: query + '%'
}
}
}, function(err, data) {
Canvas
 Only has to be accessible from the user‟s
browser
 Authentication via OAuth or Signed
Response
 JavaScript based SDK
 Within Canvas, the App can make API calls
as the current user
 apex:CanvasApp allows embedding via
Visualforce
Any Language, Any Platform
How Canvas Works
OAuth
Remote
Application
Salesforce
Platform
Sends App Credentials
User logs in,
Token sent to callback
Confirms token
Send access token
Maintain session with
refresh token
OAuth2 Authentication Flow
Tools for teams and build masters
Team Development
API to access customizations to the Force.com platform
Metadata API
Access, create and edit Force.com application code
Tooling API
Double-click to enter title
Double-click to enter text
The Wrap Up
Nos prochains évènements à Paris!
Salesforce1 Tour à Paris
Webinar en Français: Data Model & Relationships
Prenez le lead sur notre communauté de Développeurs en France !
Plus d‟information sur www.developer.salesforce.com
June
26th
April
29th
A vous
de jouer
Questionnaire en ligne
Répondre au questionnaire en ligne sur cet
ELEVATE: http://bit.ly/elevateFR
check inbox
http://bit.ly/elevateFR
Double-click to enter title
Double-click to enter text
@forcedotcom
@pchittum
@dcarroll
#forcedotcom
Double-click to enter title
Double-click to enter text
Join A
Developer User Group
http://bit.ly/fdc-dugs
PARIS DUG:
http://www.meetup.com/Paris-
Salesforce-Developer-User-Group/
Leader: Mohamed EL MOUSSAOUI
Double-click to enter title
Double-click to enter text
Become A
Developer User Group Leader
Email:
April Nassi
<anassi@salesforce.com>
Thank You
Peter Chittum
Developer Evangelist
@pchittum
pchittum@salesforce.com
Hervé Maleville
Platform Architect
@hmaleville
herve.maleville@salesforce.com

More Related Content

Viewers also liked

Boxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too MuchBoxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too MuchPeter Chittum
 
Spring '16 Release Overview - Bilbao Feb 2016
Spring '16 Release Overview - Bilbao Feb 2016Spring '16 Release Overview - Bilbao Feb 2016
Spring '16 Release Overview - Bilbao Feb 2016Peter Chittum
 
Maths Week - About Computers, for Kids
Maths Week - About Computers, for KidsMaths Week - About Computers, for Kids
Maths Week - About Computers, for KidsPeter Chittum
 
The Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour EditionThe Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour EditionPeter Chittum
 
Dreamforce '16 Sales Summit
Dreamforce '16 Sales SummitDreamforce '16 Sales Summit
Dreamforce '16 Sales SummitDreamforce
 
Salesforce.com Overview
Salesforce.com OverviewSalesforce.com Overview
Salesforce.com OverviewEdureka!
 

Viewers also liked (6)

Boxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too MuchBoxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too Much
 
Spring '16 Release Overview - Bilbao Feb 2016
Spring '16 Release Overview - Bilbao Feb 2016Spring '16 Release Overview - Bilbao Feb 2016
Spring '16 Release Overview - Bilbao Feb 2016
 
Maths Week - About Computers, for Kids
Maths Week - About Computers, for KidsMaths Week - About Computers, for Kids
Maths Week - About Computers, for Kids
 
The Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour EditionThe Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour Edition
 
Dreamforce '16 Sales Summit
Dreamforce '16 Sales SummitDreamforce '16 Sales Summit
Dreamforce '16 Sales Summit
 
Salesforce.com Overview
Salesforce.com OverviewSalesforce.com Overview
Salesforce.com Overview
 

Similar to ELEVATE Paris

Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce Developers
 
Detroit ELEVATE Track 2
Detroit ELEVATE Track 2Detroit ELEVATE Track 2
Detroit ELEVATE Track 2Joshua Birk
 
Integrating Force.com with Heroku
Integrating Force.com with HerokuIntegrating Force.com with Heroku
Integrating Force.com with HerokuPat Patterson
 
ELEVATE Advanced Workshop
ELEVATE Advanced WorkshopELEVATE Advanced Workshop
ELEVATE Advanced WorkshopJoshua Birk
 
Dive Deep into Apex: Advanced Apex!
Dive Deep into Apex: Advanced Apex! Dive Deep into Apex: Advanced Apex!
Dive Deep into Apex: Advanced Apex! Salesforce Developers
 
Advanced Apex Webinar
Advanced Apex WebinarAdvanced Apex Webinar
Advanced Apex Webinarpbattisson
 
Atl elevate programmatic developer slides
Atl elevate programmatic developer slidesAtl elevate programmatic developer slides
Atl elevate programmatic developer slidesDavid Scruggs
 
Elevate workshop programmatic_2014
Elevate workshop programmatic_2014Elevate workshop programmatic_2014
Elevate workshop programmatic_2014David Scruggs
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Samuel De Rycke
 
Visualforce: Using ActionFunction vs. RemoteAction
Visualforce: Using ActionFunction vs. RemoteActionVisualforce: Using ActionFunction vs. RemoteAction
Visualforce: Using ActionFunction vs. RemoteActionSalesforce Developers
 
Lightning Component - Components, Actions and Events
Lightning Component - Components, Actions and EventsLightning Component - Components, Actions and Events
Lightning Component - Components, Actions and EventsDurgesh Dhoot
 
Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013
Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013
Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013Salesforce Developers
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummiesdreamforce2006
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummiesdreamforce2006
 
February 2020 Salesforce API Review
February 2020 Salesforce API ReviewFebruary 2020 Salesforce API Review
February 2020 Salesforce API ReviewLydon Bergin
 
TrailheaDX 2019 : Explore New Frontiers with High Volume Platform Events
TrailheaDX 2019 :  Explore New Frontiers with High Volume Platform EventsTrailheaDX 2019 :  Explore New Frontiers with High Volume Platform Events
TrailheaDX 2019 : Explore New Frontiers with High Volume Platform EventsJohn Brock
 
Building Visualforce Custom Events Handlers
Building Visualforce Custom Events HandlersBuilding Visualforce Custom Events Handlers
Building Visualforce Custom Events HandlersSalesforce Developers
 

Similar to ELEVATE Paris (20)

Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmers
 
Detroit ELEVATE Track 2
Detroit ELEVATE Track 2Detroit ELEVATE Track 2
Detroit ELEVATE Track 2
 
Integrating Force.com with Heroku
Integrating Force.com with HerokuIntegrating Force.com with Heroku
Integrating Force.com with Heroku
 
ELEVATE Advanced Workshop
ELEVATE Advanced WorkshopELEVATE Advanced Workshop
ELEVATE Advanced Workshop
 
Intro to Apex Programmers
Intro to Apex ProgrammersIntro to Apex Programmers
Intro to Apex Programmers
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
 
Dive Deep into Apex: Advanced Apex!
Dive Deep into Apex: Advanced Apex! Dive Deep into Apex: Advanced Apex!
Dive Deep into Apex: Advanced Apex!
 
Advanced Apex Webinar
Advanced Apex WebinarAdvanced Apex Webinar
Advanced Apex Webinar
 
Atl elevate programmatic developer slides
Atl elevate programmatic developer slidesAtl elevate programmatic developer slides
Atl elevate programmatic developer slides
 
Elevate workshop programmatic_2014
Elevate workshop programmatic_2014Elevate workshop programmatic_2014
Elevate workshop programmatic_2014
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015
 
Visualforce: Using ActionFunction vs. RemoteAction
Visualforce: Using ActionFunction vs. RemoteActionVisualforce: Using ActionFunction vs. RemoteAction
Visualforce: Using ActionFunction vs. RemoteAction
 
Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex
 
Lightning Component - Components, Actions and Events
Lightning Component - Components, Actions and EventsLightning Component - Components, Actions and Events
Lightning Component - Components, Actions and Events
 
Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013
Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013
Salesforce1 Platform ELEVATE LA workshop Dec 18, 2013
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummies
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummies
 
February 2020 Salesforce API Review
February 2020 Salesforce API ReviewFebruary 2020 Salesforce API Review
February 2020 Salesforce API Review
 
TrailheaDX 2019 : Explore New Frontiers with High Volume Platform Events
TrailheaDX 2019 :  Explore New Frontiers with High Volume Platform EventsTrailheaDX 2019 :  Explore New Frontiers with High Volume Platform Events
TrailheaDX 2019 : Explore New Frontiers with High Volume Platform Events
 
Building Visualforce Custom Events Handlers
Building Visualforce Custom Events HandlersBuilding Visualforce Custom Events Handlers
Building Visualforce Custom Events Handlers
 

More from Peter Chittum

Dreamforce 2013 - Enhancing the Chatter Feed with Topics and Apex
Dreamforce 2013 - Enhancing the Chatter Feed with Topics and ApexDreamforce 2013 - Enhancing the Chatter Feed with Topics and Apex
Dreamforce 2013 - Enhancing the Chatter Feed with Topics and ApexPeter Chittum
 
Winter 21 Developer Highlights for Salesforce
Winter 21 Developer Highlights for SalesforceWinter 21 Developer Highlights for Salesforce
Winter 21 Developer Highlights for SalesforcePeter Chittum
 
LMS Lightning Message Service
LMS Lightning Message ServiceLMS Lightning Message Service
LMS Lightning Message ServicePeter Chittum
 
Apply the Salesforce CLI To Everyday Problems
Apply the Salesforce CLI To Everyday ProblemsApply the Salesforce CLI To Everyday Problems
Apply the Salesforce CLI To Everyday ProblemsPeter Chittum
 
If You Can Write a Salesforce Formula, You Can Use the Command Line
If You Can Write a Salesforce Formula, You Can Use the Command LineIf You Can Write a Salesforce Formula, You Can Use the Command Line
If You Can Write a Salesforce Formula, You Can Use the Command LinePeter Chittum
 
If you can write a Salesforce Formula you can use the command line
If you can write a Salesforce Formula you can use the command lineIf you can write a Salesforce Formula you can use the command line
If you can write a Salesforce Formula you can use the command linePeter Chittum
 
Do Not Fear the Command Line
Do Not Fear the Command LineDo Not Fear the Command Line
Do Not Fear the Command LinePeter Chittum
 
Don't Fear the Command Line
Don't Fear the Command LineDon't Fear the Command Line
Don't Fear the Command LinePeter Chittum
 
Best api features of 2016
Best api features of 2016Best api features of 2016
Best api features of 2016Peter Chittum
 
Streaming api with generic and durable streaming
Streaming api with generic and durable streamingStreaming api with generic and durable streaming
Streaming api with generic and durable streamingPeter Chittum
 
Salesforce Platform Encryption Developer Strategy
Salesforce Platform Encryption Developer StrategySalesforce Platform Encryption Developer Strategy
Salesforce Platform Encryption Developer StrategyPeter Chittum
 
All Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action ServiceAll Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action ServicePeter Chittum
 
Dreamforce 15 - Platform Encryption for Developers
Dreamforce 15 - Platform Encryption for DevelopersDreamforce 15 - Platform Encryption for Developers
Dreamforce 15 - Platform Encryption for DevelopersPeter Chittum
 
Platform Encryption World Tour Admin Zone
Platform Encryption World Tour Admin ZonePlatform Encryption World Tour Admin Zone
Platform Encryption World Tour Admin ZonePeter Chittum
 
Salesforce Lightning Components and App Builder EMEA World Tour 2015
Salesforce Lightning Components and App Builder EMEA World Tour 2015Salesforce Lightning Components and App Builder EMEA World Tour 2015
Salesforce Lightning Components and App Builder EMEA World Tour 2015Peter Chittum
 
Building Applications on the Salesforce1 Platform for Imperial College London
Building Applications on the Salesforce1 Platform for Imperial College LondonBuilding Applications on the Salesforce1 Platform for Imperial College London
Building Applications on the Salesforce1 Platform for Imperial College LondonPeter Chittum
 
Elevate london dec 2014.pptx
Elevate london dec 2014.pptxElevate london dec 2014.pptx
Elevate london dec 2014.pptxPeter Chittum
 
AngularJS App In Two Weeks
AngularJS App In Two WeeksAngularJS App In Two Weeks
AngularJS App In Two WeeksPeter Chittum
 
Df14 Salesforce Advanced Developer Certification
Df14 Salesforce Advanced Developer CertificationDf14 Salesforce Advanced Developer Certification
Df14 Salesforce Advanced Developer CertificationPeter Chittum
 
Javascript and Remote Objects on Force.com Winter 15
Javascript and Remote Objects on Force.com Winter 15Javascript and Remote Objects on Force.com Winter 15
Javascript and Remote Objects on Force.com Winter 15Peter Chittum
 

More from Peter Chittum (20)

Dreamforce 2013 - Enhancing the Chatter Feed with Topics and Apex
Dreamforce 2013 - Enhancing the Chatter Feed with Topics and ApexDreamforce 2013 - Enhancing the Chatter Feed with Topics and Apex
Dreamforce 2013 - Enhancing the Chatter Feed with Topics and Apex
 
Winter 21 Developer Highlights for Salesforce
Winter 21 Developer Highlights for SalesforceWinter 21 Developer Highlights for Salesforce
Winter 21 Developer Highlights for Salesforce
 
LMS Lightning Message Service
LMS Lightning Message ServiceLMS Lightning Message Service
LMS Lightning Message Service
 
Apply the Salesforce CLI To Everyday Problems
Apply the Salesforce CLI To Everyday ProblemsApply the Salesforce CLI To Everyday Problems
Apply the Salesforce CLI To Everyday Problems
 
If You Can Write a Salesforce Formula, You Can Use the Command Line
If You Can Write a Salesforce Formula, You Can Use the Command LineIf You Can Write a Salesforce Formula, You Can Use the Command Line
If You Can Write a Salesforce Formula, You Can Use the Command Line
 
If you can write a Salesforce Formula you can use the command line
If you can write a Salesforce Formula you can use the command lineIf you can write a Salesforce Formula you can use the command line
If you can write a Salesforce Formula you can use the command line
 
Do Not Fear the Command Line
Do Not Fear the Command LineDo Not Fear the Command Line
Do Not Fear the Command Line
 
Don't Fear the Command Line
Don't Fear the Command LineDon't Fear the Command Line
Don't Fear the Command Line
 
Best api features of 2016
Best api features of 2016Best api features of 2016
Best api features of 2016
 
Streaming api with generic and durable streaming
Streaming api with generic and durable streamingStreaming api with generic and durable streaming
Streaming api with generic and durable streaming
 
Salesforce Platform Encryption Developer Strategy
Salesforce Platform Encryption Developer StrategySalesforce Platform Encryption Developer Strategy
Salesforce Platform Encryption Developer Strategy
 
All Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action ServiceAll Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action Service
 
Dreamforce 15 - Platform Encryption for Developers
Dreamforce 15 - Platform Encryption for DevelopersDreamforce 15 - Platform Encryption for Developers
Dreamforce 15 - Platform Encryption for Developers
 
Platform Encryption World Tour Admin Zone
Platform Encryption World Tour Admin ZonePlatform Encryption World Tour Admin Zone
Platform Encryption World Tour Admin Zone
 
Salesforce Lightning Components and App Builder EMEA World Tour 2015
Salesforce Lightning Components and App Builder EMEA World Tour 2015Salesforce Lightning Components and App Builder EMEA World Tour 2015
Salesforce Lightning Components and App Builder EMEA World Tour 2015
 
Building Applications on the Salesforce1 Platform for Imperial College London
Building Applications on the Salesforce1 Platform for Imperial College LondonBuilding Applications on the Salesforce1 Platform for Imperial College London
Building Applications on the Salesforce1 Platform for Imperial College London
 
Elevate london dec 2014.pptx
Elevate london dec 2014.pptxElevate london dec 2014.pptx
Elevate london dec 2014.pptx
 
AngularJS App In Two Weeks
AngularJS App In Two WeeksAngularJS App In Two Weeks
AngularJS App In Two Weeks
 
Df14 Salesforce Advanced Developer Certification
Df14 Salesforce Advanced Developer CertificationDf14 Salesforce Advanced Developer Certification
Df14 Salesforce Advanced Developer Certification
 
Javascript and Remote Objects on Force.com Winter 15
Javascript and Remote Objects on Force.com Winter 15Javascript and Remote Objects on Force.com Winter 15
Javascript and Remote Objects on Force.com Winter 15
 

Recently uploaded

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

ELEVATE Paris

  • 1. Advanced Developer Workshop Peter Chittum Developer Evangelist @pchittum pchittum@salesforce.com Hervé Maleville Platform Architect @hmaleville herve.maleville@salesforce.com
  • 2. Wifi Access SSID: Guest Password: fBSuBLqe http://bit.ly/elevate_adv_workbook Login and Get Ready
  • 5. Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward- looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal quarter ended July 31, 2011. This document and others are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward- looking statements.
  • 6. Nos prochains évènements à Paris! Salesforce1 Tour à Paris Webinar en Français: Data Model & Relationships Prenez le lead sur notre communauté de Développeurs en France ! Plus d‟information sur www.developer.salesforce.com June 26th April 29th A vous de jouer
  • 8. Salesforce is a Platform Company. Period. -Alex Williams, TechCrunch 600MAPI Calls Per Day 6BLines of Apex 4M+Apps Built on the Platform 72BRecords Stored Salesforce1 Platform
  • 10. Editor Of Choice For the Eclipse fans in the room
  • 11.
  • 12. Warehouse Application Requirements  Track price and inventory on hand for all merchandise  Create invoices containing one or more merchandise items as a line items  Present total invoice amount and current shipping status
  • 13. Warehouse Data Model Merchandise Name Price Inventory Pinot $20 15 Cabernet $30 10 Malbec $20 20 Zinfandel $10 50 Invoice Number Status Count Total INV-01 Shipped 16 $370 INV-02 New 20 $200 Invoice Line Items Invoice Line Merchandise Units Sold Unit Price Value INV-01 1 Pinot 1 15 $20 INV-01 2 Cabernet 5 10 $150 INV-01 3 Malbec 10 20 $200 INV-02 1 Pinot 20 50 $200
  • 14. Apex
  • 15. Introduction to Apex  Object-Oriented Language  Dot Notation Syntax  Case Insenstive  “First Class” Citizen on the Platform
  • 16. Apex Anatomy Chapter 1: public with sharing class myControllerExtension implements Util { private final Account acct; public Contact newContact {get; set;} public myControllerExtension(ApexPages.StandardController stdController) { this.acct = (Account)stdController.getRecord(); } public PageReference associateNewContact(Id cid) { newContact = [SELECT Id, Account from Contact WHERE Id =: cid LIMIT 1]; newContact.Account = acct; update newContact; } } Class and Interface based Scoped Variables   Inline SOQL Inline DML  
  • 17. Developer Console  Browser Based IDE  Create and Edit Classes  Create and Edit Triggers  Run Unit Tests  Review Debug Logs
  • 18. Apex Triggers  Event Based Logic  Associated with Object Types  Before or After:  Insert  Update  Delete  Undelete
  • 19. Controlling Flow trigger LineItemTrigger on Line_Item__c (before insert, before update) { //separate before and after if(Trigger.isBefore) { //separate events if(Trigger.isInsert) { System.debug(‘BEFORE INSERT’); DelegateClass.performLogic(Trigger.new);
  • 20. Static Flags public with sharing class AccUpdatesControl { // This class is used to prevent multiple calls public static boolean calledOnce = false; public static boolean ProdUpdateTrigger = false; }
  • 21. Chatter Triggers trigger AddRegexTrigger on Blacklisted_Word__c (before insert, before update) { for (Blacklisted_Word__c f : trigger.new) { if(f.Custom_Expression__c != NULL) { f.Word__c = ''; f.Match_Whole_Words_Only__c = false; f.RegexValue__c = f.Custom_Expression__c; } } }
  • 22. Trigger Tutorial  Basic: Tutorial 2  Intermediate: Tutorial 4  Beyond Intermediate: http://bit.ly/ELEV-triggers http://bit.ly/elevate_adv_workbook
  • 23. Unit Testing in Apex  Built in support for testing – Test Utility Class Annotation – Test Method Annotation – Test Data build up and tear down  Unit test coverage is required – Must have at least 75% of code covered  Why is it required?
  • 24. Unit Testing • Declare Classes/Code as Test • isTest Annotation • testmethod keyword • Default data scope is test only
  • 25. Testing Context // this is where the context of your test begins Test.StartTest(); //execute future calls, batch apex, scheduled apex // this is where the context ends Text.StopTest(); System.assertEquals(a,b); //now begin assertions
  • 26. Testing Permissions //Set up user User u1 = [SELECT Id FROM User WHERE Alias='auser']; //Run As U1 System.RunAs(u1){ //do stuff only u1 can do }
  • 27. Static Resource Data List<Invoice__c> invoices = Test.loadData(Invoice__c.sObjectType, 'InvoiceData'); update invoices;
  • 28. Mock HTTP Endpoints @isTest global class MockHttp implements HttpCalloutMock { global HTTPResponse respond(HTTPRequest req) { // Create a fake response HttpResponse res = new HttpResponse(); res.setHeader('Content-Type', 'application/json'); res.setBody('{"foo":"bar"}'); res.setStatusCode(200); return res; } }
  • 29. Mock HTTP Endpoints @isTest private class CalloutClassTest { static void testCallout() { Test.setMock(HttpCalloutMock.class, new MockHttp()); HttpResponse res = CalloutClass.getInfoFromExternalService(); // Verify response received contains fake values String actualValue = res.getBody(); String expectedValue = '{"foo":"bar"}'; System.assertEquals(actualValue, expectedValue); } }
  • 32. Apex Batch Processing  Governor Limits – Various limitations around resource usage  Asynchronous processing – Send your job to a queue and we promise to run it  Can be scheduled to run later – Kind of like a chron job
  • 33. Batchable Interface global with sharing class WHUtil implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { //Start on next context } global void execute(Database.BatchableContext BC, List<sObject> scope) { //Execute on current scope } global void finish(Database.BatchableContext BC) { //Finish and clean up context } }
  • 34. Implementing Apex Batch Processing Apex Batch Processing Tutorial
  • 36. Schedulable Interface global with sharing class WarehouseUtil implements Schedulable { //General constructor global WarehouseUtil() {} //Scheduled execute global void execute(SchedulableContext ctx) { //Use static method for checking dated invoices WarehouseUtil.checkForDatedInvoices(); } }
  • 37. Schedulable Interface System.schedule('testSchedule','0 0 13 * * ?', new WarehouseUtil()); Via Apex Via Web UI
  • 38. Unit Testing Batch Apex Test.StartTest(); System.schedule(‘once','0 0 13 * * ?',new,WarehouseUtil()); ID batchprocessid = Database.executeBatch(new WarehouseUtil()); Test.StopTest();
  • 41. Apex REST @RestResource(urlMapping='/CaseManagement/v1/*') global with sharing class CaseMgmtService { @HttpPost global static String attachPic() { RestRequest req = RestContext.request; RestResponse res = Restcontext.response; Id caseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1); Blob picture = req.requestBody; Attachment a = new Attachment (ParentId = caseId, Body = picture, ContentType = 'image/
  • 42. Apex REST Services REST Services with Apex Tutorial
  • 44. Framework  Server-side compiled web pages – (Think PHP, JSP, etc.)  Easily create salesforce UI  Standard-compliant  Can Interact With Apex for Custom Logic
  • 45. Visualforce Tags <apex:page docType=“html-5.0” /> <apex:input type=“email”/> <apex:pageBlockSection collapsible=“false” />
  • 46. Hashed information block to track server side transports Viewstate
  • 47. Apex Form  Required for standard salesforce post  Incurs Viewstate Overhead <apex:form> … </apex:form aspdoifuapknva894372h 4ofincao98vh0q938hfoq iwnbdco8q73h0o9fqubov ilbodfubqo3e8ufbw
  • 48. Interacting with Apex  ActionFunction allows direct binding of variables  ActionFunction requires ViewState  JavaScript Remoting binds to static methods  JavaScript Remoting uses no ViewState  Transient, Private and Static reduce Viewstate
  • 49. Apex Remote Action  Static  No View State  Invoked through JS API  Invokes JS Callback @remoteAction global static String myMethod(String inputParam){ ... }
  • 50. Calling Apex Remote Action Visualforce.remoting.Manager.invokeAction(’ {!$RemoteAction.RemoteClass.methodName}' , param, function(result, event) { //...callback to handle result });
  • 51. Event Object: Success Example { "statusCode":200, "type":"rpc", "ref":false, "action":"IncidentReport", "method":"createIncidentReport", "result":"a072000000pt1ZLAAY", "status":true }
  • 52. Event Object: Failure Example { "statusCode":400, "type":"exception", "action":"IncidentReport", "method":"createIncidentReport", "message":"List has more than 1 row for assignment to SObject", "data": {"0": {"Merchandise__c":"a052000000GUgYgAAL","Type__c":"Accident","Desc ription__c":"This is an accident report"}}, "result":null, "status":false }
  • 53. Interacting with the Publisher: Allow Submit  Make Submit Active  Payload true/false Sfdc.canvas.publisher.publish( { name: "publisher.setValidForSubmit", payload:true });
  • 54. Interacting with the Publisher: Subscribe to Submit  Attach to Submit Event Sfdc.canvas.publisher.subscribe({ name: "publisher.post", onData:function(e) { // This subscribe fires when the user hits 'Submit' in the publisher postToFeed(); }});
  • 55. Interacting with the Publisher: Close Publisher  Make the Submit Happen Sfdc.canvas.publisher.publish({name: "publisher.close", payload: { refresh:"true"}});
  • 56. The Future! (Well, Spring „14)
  • 57. Remote Objects  Standard CRUD/Q functionality without Apex  Similar to remoteTK or SObjectData  Visualforce components define data models <apex:jsSObjectBase shortcut="tickets"> <apex:jsSObjectModel name="Ticket__c" /> <apex:jsSObjectModel name="Contact" fields="Email" /> <script> var contact = new tickets.Contact(); contact.retrieve({ where: { Email: { like: query + '%' } } }, function(err, data) {
  • 59.  Only has to be accessible from the user‟s browser  Authentication via OAuth or Signed Response  JavaScript based SDK  Within Canvas, the App can make API calls as the current user  apex:CanvasApp allows embedding via Visualforce Any Language, Any Platform How Canvas Works
  • 60. OAuth
  • 61. Remote Application Salesforce Platform Sends App Credentials User logs in, Token sent to callback Confirms token Send access token Maintain session with refresh token OAuth2 Authentication Flow
  • 62.
  • 63. Tools for teams and build masters Team Development
  • 64. API to access customizations to the Force.com platform Metadata API
  • 65. Access, create and edit Force.com application code Tooling API
  • 66. Double-click to enter title Double-click to enter text The Wrap Up
  • 67. Nos prochains évènements à Paris! Salesforce1 Tour à Paris Webinar en Français: Data Model & Relationships Prenez le lead sur notre communauté de Développeurs en France ! Plus d‟information sur www.developer.salesforce.com June 26th April 29th A vous de jouer
  • 68. Questionnaire en ligne Répondre au questionnaire en ligne sur cet ELEVATE: http://bit.ly/elevateFR
  • 70. Double-click to enter title Double-click to enter text @forcedotcom @pchittum @dcarroll #forcedotcom
  • 71. Double-click to enter title Double-click to enter text Join A Developer User Group http://bit.ly/fdc-dugs PARIS DUG: http://www.meetup.com/Paris- Salesforce-Developer-User-Group/ Leader: Mohamed EL MOUSSAOUI
  • 72. Double-click to enter title Double-click to enter text Become A Developer User Group Leader Email: April Nassi <anassi@salesforce.com>
  • 73. Thank You Peter Chittum Developer Evangelist @pchittum pchittum@salesforce.com Hervé Maleville Platform Architect @hmaleville herve.maleville@salesforce.com

Editor's Notes

  1. Change this slide to match the local internet requirements.The bit.ly link points to the latest HTML draft of the new workbook. This is different than the official workbook on developer.force.com and there are schema differences, so attendees cannot mix and match.
  2. Highlight that this is not just a day of talking to them, this is a dialogue and they should ask questions as they like – even ones that don’t pertain to the current “section”. Projects they’re working on, features they have heard about, etc.
  3. THERE IS NOT A CURRENT ONLINE VERSION OF THE NEW WORKBOOK DRAFT
  4. Safe Harbor
  5. Safe Harbor
  6. Safe Harbor
  7. Safe Harbor
  8. Let’s have an exercise in requirements gathering. Here is some of the core needs for our Warehouse application. What nouns here should we be looking at to model our data with?
  9. Here is an overview of what our data model will look like. Recommended: Break into a demo of building data in the browser, either custom object wizard or schema builder depending on audience/workbooks
  10. For when declarative logic is not enough, we provide Apex. Apex is a cloud-based programming language, very similar to Java – except that you can code, compile and deploy all right from your Salesforce instance. You’ll see how we can create robust programmatic functions right from your browser.
  11. TestCleanUpBatchClass https://gist.github.com/dcarroll/9609978CleanUpRecords https://gist.github.com/dcarroll/9609997CreateMerchandiseData https://gist.github.com/dcarroll/9610037MyScheduler  https://gist.github.com/dcarroll/9610109Execute Anonymous:CreateMerchandiseData.GenerateMerchandiseData();MyScheduler.RunInOneMinute();
  12. TestCleanUpBatchClass https://gist.github.com/dcarroll/9609978 http://bit.ly/UnitTestApexCleanUpRecords https://gist.github.com/dcarroll/9609997 http://bit.ly/CleanUpRecordsCreateMerchandiseData https://gist.github.com/dcarroll/9610037  http://bit.ly/CreateMerchandiseDataMyScheduler  https://gist.github.com/dcarroll/9610109  http://bit.ly/MySchedulerExecute Anonymous:CreateMerchandiseData.GenerateMerchandiseData();MyScheduler.RunInOneMinute();
  13. For when declarative logic is not enough, we provide Apex. Apex is a cloud-based programming language, very similar to Java – except that you can code, compile and deploy all right from your Salesforce instance. You’ll see how we can create robust programmatic functions right from your browser.
  14. Result is the return from the invoked method.Event is an object that represents data returned from the callback to communicate the state of the call (success, failure, HTTP code, This could do with examples on what to do with the result.
  15. This is an excerpt showing some of the important attributes. The full JSON response taken from this example is below:{&quot;statusCode&quot;:400,&quot;type&quot;:&quot;exception&quot;,&quot;tid&quot;:2,&quot;ref&quot;:false,&quot;action&quot;:&quot;IncidentReport&quot;,&quot;method&quot;:&quot;createIncidentReport&quot;,&quot;message&quot;:&quot;List has more than 1 row for assignment to SObject&quot;,&quot;where&quot;:&quot;&quot;,&quot;data&quot;:{&quot;0&quot;:{&quot;Merchandise__c&quot;:&quot;a052000000GUgYgAAL&quot;,&quot;Type__c&quot;:&quot;Accident&quot;,&quot;Description__c&quot;:&quot;asdfasdf&quot;}},&quot;vfTx&quot;:true,&quot;vfDbg&quot;:true,&quot;result&quot;:null,&quot;status&quot;:false}
  16. For when declarative logic is not enough, we provide Apex. Apex is a cloud-based programming language, very similar to Java – except that you can code, compile and deploy all right from your Salesforce instance. You’ll see how we can create robust programmatic functions right from your browser.
  17. Update this subtitle
  18. Safe Harbor
  19. Safe Harbor