Elevate Tel Aviv

Post on 10-May-2015

267 views 3 download

Tags:

description

This is the deck for the programmatic track of Elevate. Elevate is a hands-on, one day training teaching new developers about foundational programmatic features of the Salesforce1 Platform.

Transcript of Elevate Tel Aviv

Coding The Cloud with Apex and VisualforceProgrammatic Elevate Workshop

Samantha Ready - Developer Evangelist@samantha_readysready@salesforce.com

Dave Carroll – Developer Evangelist@dcarrolldcarroll@salesforce.com

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 product or service availability, 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, new products and services, 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, the outcome of intellectual property and other litigation, 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-Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures 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 presentations, 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.

Welcome!

WIFI Connection

SSID: Elevate

PWD: salesforce1

What we want to accomplish today

Jumpstart Programmatic Development on Force.com

Learn how to use the Apex Language

Understand how to use Visualforce for Salesforce1

Experience coding the cloud

Enjoy ourselves in the process

What should know already

Some exposure to Salesforce1 Platform– Beginner workshop is a great preparation

(but not required)

Programming experience in another language– .Net or Java or Ruby or Javascript (but not

required)

Web programming experience– HTML and CSS (but not required)

The Salesforce1 Customer Platform

Salesforce1 Platform APIs

Salesforce1 App

Salesforce1 Platform Services

Force.com HerokuExactTarget

Fuel

Over 1.5 Million Registered Developers

102 Developer User Groups

Salesforce1 Platform

Salesforce is a Platform Company. Period.-Alex Williams, TechCrunch

1BAPI Calls Per Day

6BLines of Apex

4M+Apps Built on the Platform

1T+Records Processed per Month

Consider Becoming a Certified Developer

Brief Overview of the App So Far

Warehousing app– Tracks inventory

– Checks for valid data

– Stores delivery info

That’s the data model there >>

Missed the beginner track?

Demo on Data Modeling

Workbook Preparation – Let’s do this together!

Start with a new Developer Edition

Install Warehouse Sample Application

Try out the Salesforce1 Browser App

Install the Salesforce1 Mobile App– Search Salesforce1 in Apple App Store or in Google Play

Store

Tutorial 1

Developer Basics – Tools of the Trade

Built in Editors

Developer Console

Eclipse Plugin

Command Line Interface

Workbench

Third Party Tools

Developer Console Tour

Tutorial 2

Apex Language Orientation

It’s like Java or .Net– Strongly typed with curly braces

Common primitive data types

Familiar collections and logic constructs

Classes and Interfaces and Inheritance

Familiar polymorphic exception handling

This is what it looks like

Invoking Apex Code

Can be executed directly– Execute Anonymous

Can be triggered by database changes– Insert, Update, Delete, before and after triggers

Can be directly called through REST– Custom Apex Rest Service

Invoked as the controller portion of a Visualforce page

Apex Has Data Manipulation Built In

Query is first class part of the language– [Select Id, Name From Account Where Country = ‘UK’]

Insert, update, delete and upsert

Full database transaction control– SetSavePoint and Rollback

Operates on sets of or single sObjects

Retrieving Data Using SOQL and SOSL

SOQL is like SQL, only one verb supported (select)– Aggregation, grouping, and geolocation are all

supported

– Relationship navigation, sub queries and anti joins are supported

SOSL is for searching for data across columns and tables– Full text search and polymorphic results across objects

– Supports abstract search field specification• Find “5559993344” in Phone Fields

What is an sObject?

It is a chunk of data, a kin to a record, but more– An sObject can contain a sef of other sObjects (child

records)

– All stored data is represented as an sObject

– They all have a universally unique Id (kind of like a foreign key)

Automatically available through a REST endpoint

Can have computed fields (we call them formula fields)

Working with sObjects

DML Demo

Implementing Triggers

Excellent choice to enforce business logic– Triggers fire no matter what caused the data change

Triggers operate in bulk– You should assume that more than one record is part of

the execution scope

Consider the use of Asynchronous options– Calling out to a web service, cascading changes to

many different objects

Implementing Triggers

Let’s look at some triggers…

Implementing Triggers

Trigger Tutorial

Workbook: http://bit.ly/telaviv_guide

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?

Implementing Unit Tests

Unit Test Demo

Implementing Unit Tests

Unit Test Tutorial

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

Implementing Apex Batch Processing

Apex Batch Processing Tutorial

Writing Your Own REST Service with Apex

Aggregating DML– Most REST services are very granular

Implementing database transactions in REST– Enforce you business logic at the data layer

Common “servlet” model– Annotations to specify POST, GET, PATCH, DELETE

You control the URL Mapping for the resource

Implementing Apex Rest Services

Apex Rest Services Tutorial

Let’s Take a Break!

Lunch Break

What can you do with Visualforce?

Framework to build custom user interfaces

Hosted natively on Force.com

Build streamlined UX

Create internal and public facing pages

Customize for different devices

Leverage other web technologies

Model View Controller (MVC) PatternStandard and

Custom ObjectsStandard

Controllers and Apex

Visualforce

Mobile Visualforce in Salesforce1

Where can I put Visualforce Pages?– Navigation Menu

– Publisher

– Record Homepage – Mobile Cards

Build UI with ‘Mobile Ready’ techniques (responsive, CSS, etc)

Navigation: sforce.one object– Ex: sforce.one.navigateToRelatedList(relatedListId,

parentRecordId)

The Salesforce1 App

All your past investments...

Drag and drop UI customization

Notifications Platform

Publisher Actions

...now in the future

Download Salesforce1 App today

All Your Customization

s

All Your Devices

All Your CRM

All Your Apps

https://yourinstance.salesforce.com/one/one.app

Adding Visualforce to Global Navigation

Responsive VF Page

in Left Nav Demo

Visualforce – Left Nav

Visualforce tabs in Mobile

Navigationsforce.one object for

navigation

Adding Visualforce to Global Navigation

Global Navigation Tutorial

Adding Visualforce to Global Navigation

Directions & Check In

App Demo

Visualforce – Publisher Actions

Visualforce Pages as Publisher Actions

(Object Specific vs Global)

JavaScript Pub-Sub library available to interact with the publisher

publisher.setValidForSubmit

publisher.post

publisher.close

Visualforce – Mobile Cards

Mobile Cards - Visualforce Pages on

Record Detail(VF page needs to the extend

Standard Controller)

Visualforce in Salesforce1

<apex:page docType="html-5.0" …>

‘Available for Salesforce Mobile apps’ flag enabled

Developers are responsible for making the VF page ‘mobile ready’

• Use a Responsive Design framework like Bootstrap or Mobile Design templates

• Leverage touch and swipe events where appropriate

Use JavaScript Remoting/VF Remote Objects for better performance

Use HTML5 for device features like Geolocation and Camera access

Visualforce Mobile Cards and Actions in Salesforce1

Mobile Card &

Publisher Action

Tutorial

Salesforce Canvas Overview

Enable integration of external applications securely within Salesforce1 from the native environment– Javascript API, Secure Authentication, Context Services,

X-Domain API, Eventing Model, App Registration and Management

When might you use Canvas?

Your data does not reside in salesforce.com– The data is best consumed in the context of salesforce,

but is not required to reside there

You have developers focused on other technologies– Sometimes Salesforce1 developers are hard to find

You have an existing application– Don’t need to reinvent the wheel

Using Canvas in Salesforce 1

Canvas Tutorial

Useful Resources

Join a Developer User Group– http://bit.ly/fdc-dugs

– Birmingham West Midlands - bit.ly/birminghamdug

– London – bit.ly/londondug

– Bristol – bit.ly/bristoldug

– Dublin – bit.ly/dublindug

Become a Developer User Group Leader– Email: April Nassi anassi@salesforce.com

Developer Force – Resources and More

Thank You