SlideShare une entreprise Scribd logo
1  sur  43
Salesforce1 Events App on AngularJS 
in Two Weeks 
Peter Chittum 
Developer Evangelist 
salesforce.com 
@pchittum 
Adrian Smalley 
Lead Salesforce Architect 
Acumen Solutions 
@adriansmalley
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 any litigation, risks associated with 
completed and any 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 year 
and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These 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.
Peter Chittum 
Developer Evangelist 
@pchittum 
github.com/pchittum
Adrian Smalley 
Lead Salesforce Architect - UK 
@adriansmalley
2 Min DEMO 
Adrian : EventFlex
EventFlex 
Before we begin…. 
• This app is open source and an accelerator for those wishing to take it further. 
• It is hosted on github : https://github.com/adriansmalley/eventflex 
• Showcases cool features but isn’t quite production ready. You have been warned.
Our Approach 
Adrian : Begin with the end in mind
Timeline 
Acumen’s approach to custom SF1 App creation 
Initiate Define Build Deliver Launch 
1 2 3 4 5 6 7 8 9 10 
UX SF1 Config Angular App Data Layer Front end Dev
Who and How?! 
The criticalness of UX and Wireframing 
Solution 
Team 
Tools 
?! 
UX & BA Admin Angluar & SF DEV 
Google Docs 
Balsamiq 
Git Issues 
Github 
UX
Step 1 : Persona’s, Design, Style, UX 
Adrian : Bringing user experience to the centre of app development
Have the user at the heart and the start 
Thinking about User Experience from the beginning 
# 1 
# 2 
# 3 
1. Personas 2. Stories 3. Prioritise Stories 
4. User Flows 5. Wireframes 6. Design 
UX
Begin with the end in Mind 
The criticalness of UX and Wireframing 
4 Version of this 
screen before 
deciding 
Choosing Charts 
before development 
Single attempt at Build! 
UX
Visualforce on Salesforce1 
Peter : Connecting Angular, Salesforce1, and Visualforce
Salesforce1 Mobile 
Extensible Hybrid Mobile App 
• Point and Click 
• Visualforce 
• Canvas 
• NEW! Lightning Components 
Salesforce1
Salesforce1 + Visualforce 
• Publisher Action 
• Visualforce Tab 
• Mobile Card 
Salesforce1
Your Visualforce Page in Salesforce1 
<!-- Visualforce Basic Page Setup --> 
<apex:page docType="HTML-5.0" showHeader="false" sidebar="false" 
standardStylesheets="false" controller="EventFlexServices"> 
Salesforce1 
<!-- use static resources --> 
<apex:includeScript value="{!URLFOR($Resource.efLibs,'angular/angular.min.js')}" /> 
... 
<apex:stylesheet value="{!URLFOR($Resource.efLibs, 
'bootstrap1/css/bootstrap.min.css')}"/>
Angular App Architecture 
Peter : Angular in SFDC
BASE HTMLPAGE 
App Structure 
APEX Classes 
JAVASCRIPT 
• APP STARTUP 
• DIRECTIVES 
• CONTROLLERS 
• SERVICES 
ANGULARJS MODULE 
LIBS 
CSS 
HTML VIEWS (PARTIALS) 
VISUALFORCEPAGE 
Static Resources 
Static Resources 
Static Resources 
Static Resources/Bundle 
AngularJS 
App
Static Resource Mapping 
var staticItems = { 
'efMainHTML' : "{!URLFOR($Resource.efMainHTML)}", 
'efSessionHTML' : "{!URLFOR($Resource.efSessionHTML)}", 
... 
'getSessionTopics':'{!$RemoteAction.EventFlexServices.getSessionTopics}', 
'getSessionSpeakers' : '{!$RemoteAction.EventFlexServices.getSessionSpeakers}’, 
... 
}; 
AngularJS 
App
The Components 
BOOTSTRAP(-SF1) 
ANGULARJS 
VISUALFORCE 
The “VAB” Stack 
AngularJS 
App
Why AngularJS 
• Structured JS 
• Convention creates familiarity 
• Adaptable, Extensible 
• Big community 
• Enterprise ready 
AngularJS 
App
AngularJS App Startup 
<div class="container-fluid" ng-app="eventflex"> 
<div ng-view="#" class="slide container"></div> 
</div> 
var eventFlex = angular.module('eventflex', ['ngRoute', 'ngAnimate', 'gantt']); 
App Name Included Modules 
AngularJS 
App
AngularJS Page Views & Routing 
Page UI templates 
eventFlex.config(function($routeProvider) { 
$routeProvider 
.when('/', { templateUrl : staticItems['efMainHTML'], 
controller : 'MainCTRL' 
}) 
.when('/session/:id', {templateUrl : staticItems['efSessionHTML'], 
controller : 'SessionCTRL' 
}) 
}); 
Request URL JS Controller True File URL 
AngularJS 
App
Bootstrap-SF1 
Salesforce1 Theme for Twitter Bootstrap 
CSS Framework 
AngularJS 
App
Data Access 
Peter : Getting data
Data Access for Salesforce1 
• Remote Object 
• @RemoteAction apex Methods 
• REST API for large requests 
Data Access
AngularJS Services for Backend 
• Declare Service then Use Where Needed 
Data Access 
eventFlex.service('efSERVICES', function(){ 
return{ 
getAllEvents : function(callback){ 
...service logic... 
}, 
getSessions : function(callback){ 
...service logic… 
}... 
} 
}); 
eventFlex.controller('MainCTRL', ['$scope','efSERVICES'...,funtion($scope,efSERVICES,...{ 
...controller logic... 
};
Remote Object in Angular Service 
<apex:remoteObjects > 
<apex:remoteObjectModel name="Event__c" jsShorthand="evt” 
fields="Name,Id,OwnerId,Short_description__c,..."/> 
<apex:remoteObjectModel name="Session__c" jsShorthand="session" 
fields="Name,Id,Location_text__c,Short_description__c,Description__c,..."/> 
</apex:remoteObjectModel> 
</apex:remoteObjects> 
getEventDetails : function(eventId, callback){ 
var data = new SObjectModel.evt(); 
var whereOb = { where : {Id : {eq:eventId}}}; 
data.retrieve(whereOb,function(err, records){ 
//if failure 
if(err) alert(err.message); 
else { 
console.debug(records); 
callback(records[0]); 
} 
}); 
}, 
Data Access
@RemoteAction in AngularJS Service 
getMyFriendsAttendance : function(eventId, callback){ 
Visualforce.remoting.Manager.invokeAction( staticItems['getMyFriendsAttendance'], 
eventId, function(result, event){ 
if( event.status ) { 
callback(result); 
} 
}); 
}, 
Data Access
Components and Community 
Adrian : Power your productivity with the Angular Community
Angular Community and Directives 
There is heaps of awesome open source out there 
• Using other peoples components in your app : 
– Saves you loads of time 
– Is often better tested 
– Often more widely tested (cross browsers etc) 
• It’s easy to search for components (directives) that will help you out. 
• We used : 
– Angular Gantt (http://angular-gantt.github.io/angular-gantt) 
– Angular Charts (https://github.com/chinmaymk/angular-charts.git) 
Front End
Installing Apps / Directives 
Integrating other components 
• Adding to your app is super easy : 
1. Install 
<apex:includeScript 
value="{!URLFOR($Resource.Angula 
rD3, 'd3-master/d3.min.js')}"/> 
<apex:includeScript 
value="{!URLFOR($Resource.Angula 
rChartsJS)}" /> 
2. Inject 
var d3App = 
angular.module('d3App', 
['ngRoute', 'angularCharts']); 
3. Add to controller 
$scope.config = {} 
$scope.data = {} 
4. Use Directive in Page 
<div ng-controller="d3CTRL"> 
<div data-ac-chart="'pie'" data-ac- 
data="data" data-ac-config=" 
config" class="chart"> 
<div> 
Front End
Building the Page 
Adrian : UI development
Understanding the Data Flow 
VISUALFORCE 
CONTROLLER DIRECTIVES 
SERVICES 
APEX Classes 
The Execution Cycle 
Front End 
1. Page Loads 
2. Angular Controller calls init() 
3. Controller Calls the Services 
4. Services calls APEX classes via 
@remoteAction 
5. Data Returned from Apex to 
Services 
6. Services Returns data to 
Controller 
7. Controller Refreshes the page 
8. VOLA!
MVC for Javascript. Remarkably similar to APEX. 
APEX Controller Angular Controller 
public with sharing class efCharts { 
public Id eventId {get;set;} 
public list<events> evtList {get;set;} 
public pageReference getNewDashboard(){ 
return null; 
} 
} 
d3App.controller('d3CTRL', function($scope, 
chartServices, $routeParams) { 
$scope.eventId = $routeParams.id; 
$scope.events = []; 
$scope.refreshData = function(){ 
... 
} 
} 
Visualforce Page HTML Page 
<apex:page controller="efCharts" > 
<apex:repeat value=”{!evtlist}” var=”e”> 
{!e.Name} 
</apex:repeat> 
</apex:page> 
<div ng-app="d3App"> 
<div ng-controller="d3CTRL"> 
<ul ng-repeat=”e in events”> 
<li>{{e.Name}}</li> 
</ul> 
</div> 
</div> 
Front End
Bindings - putting stuff on the page 
• Output bindings are the simplest way to stamp data on your page using {{}} 
<span>{{Event.Start_Date__c}}</span> 
• However this prints out the wrong format so lets use a formatter. Magic. 
<span>{{Event.Start_Date__c | date : ‘dd-MM-yyyy’}}</span> 
[Works for Date, Number, Currency, Uppercase, Lowercase] 
• If we want a 2 way connection e.g. an input field we use ng-model which will refresh 
the page on change of this value. Amazing for live filtering. 
<input ng-model=”searchText”/> 
Front End
Repeats, Repeats, Repeats 
• Repeats are key to delivering lists of data. They can be either Arrays OR Objects. 
<li ng-repeat=”item in items”>{{item.Name}}</li> 
<li ng-repeat=”(key, value) in items”>{{value.Name}}</li> 
• Angular Packs some serious punch with filters 
–Simple filter that searches for anything in the array 
<li ng-repeat=”item in items | filter: searchText”>{{item.Name}}</li> 
Front End 
–Restricted filter that searches for a field on an object 
<li ng-repeat=”item in items | filter: {name:searchText}”>{{item.Name}}</li> 
–Add in orderBy for maximum control<li ng-repeat=”item in items | filter: 
searchText | orderBy:’Name’”>{{item.Name}}</li>
Directives & Partials 
• Directives are tags that allow you to create angular components. Directives can be 
reused thought out your app. 
• You need to specify how you want to register a directive Attribute or Tag: 
<span my-directive=””></span> or <my-directive></my-directive> 
• Key components of a directive include : 
–HTML template / Partial : specify how you want to display data 
–Scope : Specify which pieces of data you need 
–Link Function : specify how you want to interact with the component. 
• On your page now simply reference the directive and pass in the data 
<span my-directive=”” data-item=”dataitem”></span> 
Front End
An Example 
1. Use Attribute to get directive & 
replace original tag 
Front End 
1. Allow dataItem to be passed in. 
NOTE you use data-item=”” in the 
HTML. 
1. Template as HTML 
1. Create a link function with new scope 
and allow access to the HTML 
element and attributes. Great for 
adding on-click events, jquery etc 
myapp.directive(‘myDirective’, function() { 
return { 
restrict: 'A', 
replace: true, 
scope: { 
dataItem:’=’ 
}, 
template: 
'<span>{{dataItem.name}}</span>', 
link: function (scope, element, attr){ 
scope.dataitem2 = ‘ABCD’ 
scope.resetValue = function(){ 
scope.dataItem = scope.dataitem2 
} 
element.bind(‘click’, 
scope.resetValue); 
} 
};
So the app in the end... 
Adrian : Recap
EventFlex as a Solution 
Mapping the features to the UI 
Twitter Integration 
Chatter 
Service Cloud 
Salesforce1 
Communities 
Force.com
Questions?
AngularJS App In Two Weeks

Contenu connexe

Tendances

Apex for Admins: Beyond the Basics
Apex for Admins: Beyond the BasicsApex for Admins: Beyond the Basics
Apex for Admins: Beyond the Basics
Salesforce Developers
 

Tendances (20)

Angular%201%20to%20angular%202
Angular%201%20to%20angular%202Angular%201%20to%20angular%202
Angular%201%20to%20angular%202
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready
 
Salesforce Lightning Design System
Salesforce Lightning Design SystemSalesforce Lightning Design System
Salesforce Lightning Design System
 
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
 
Salesforce developer
Salesforce developerSalesforce developer
Salesforce developer
 
Salesforce developer
Salesforce developerSalesforce developer
Salesforce developer
 
jsForce in Action
jsForce in ActionjsForce in Action
jsForce in Action
 
6th Salesforce Developer Group - Bilbao
6th Salesforce Developer Group - Bilbao6th Salesforce Developer Group - Bilbao
6th Salesforce Developer Group - Bilbao
 
Angular-ifying Your Visualforce Pages
Angular-ifying Your Visualforce PagesAngular-ifying Your Visualforce Pages
Angular-ifying Your Visualforce Pages
 
Lightning Out: Components for the Rest of the World
Lightning Out: Components for the Rest of the WorldLightning Out: Components for the Rest of the World
Lightning Out: Components for the Rest of the World
 
What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...
What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...
What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...
 
Srecon18americas lightning talk: Auto-Cascading Security Updates Through Dock...
Srecon18americas lightning talk: Auto-Cascading Security Updates Through Dock...Srecon18americas lightning talk: Auto-Cascading Security Updates Through Dock...
Srecon18americas lightning talk: Auto-Cascading Security Updates Through Dock...
 
Angular components
Angular componentsAngular components
Angular components
 
Dreamforce 2015 Session - Angular-ifying your visualforce pages
Dreamforce 2015 Session - Angular-ifying your visualforce pagesDreamforce 2015 Session - Angular-ifying your visualforce pages
Dreamforce 2015 Session - Angular-ifying your visualforce pages
 
Salesforce Mobile DevWeek 21-28 April: Introduction to Native & Hybrid Develo...
Salesforce Mobile DevWeek 21-28 April: Introduction to Native & Hybrid Develo...Salesforce Mobile DevWeek 21-28 April: Introduction to Native & Hybrid Develo...
Salesforce Mobile DevWeek 21-28 April: Introduction to Native & Hybrid Develo...
 
Dreamforce 2014 Mobile Theatre Session - Automated Testing for Salesforce1 Mo...
Dreamforce 2014 Mobile Theatre Session - Automated Testing for Salesforce1 Mo...Dreamforce 2014 Mobile Theatre Session - Automated Testing for Salesforce1 Mo...
Dreamforce 2014 Mobile Theatre Session - Automated Testing for Salesforce1 Mo...
 
Learn Angular 9/8 In Easy Steps
Learn Angular 9/8 In Easy Steps Learn Angular 9/8 In Easy Steps
Learn Angular 9/8 In Easy Steps
 
Angular 2 Training | Angular 2 Tutorial For Beginners | Angular Certification...
Angular 2 Training | Angular 2 Tutorial For Beginners | Angular Certification...Angular 2 Training | Angular 2 Tutorial For Beginners | Angular Certification...
Angular 2 Training | Angular 2 Tutorial For Beginners | Angular Certification...
 
Apex for Admins: Beyond the Basics
Apex for Admins: Beyond the BasicsApex for Admins: Beyond the Basics
Apex for Admins: Beyond the Basics
 
Intro to Apex - Salesforce Force Friday Webinar
Intro to Apex - Salesforce Force Friday Webinar Intro to Apex - Salesforce Force Friday Webinar
Intro to Apex - Salesforce Force Friday Webinar
 

Similaire à AngularJS App In Two Weeks

Building JavaScript Applications on the Salesforce1 Platform
Building JavaScript Applications on the Salesforce1 PlatformBuilding JavaScript Applications on the Salesforce1 Platform
Building JavaScript Applications on the Salesforce1 Platform
Salesforce Developers
 
Mobile pack developer webinar
Mobile pack developer webinarMobile pack developer webinar
Mobile pack developer webinar
Raja Rao DV
 
Spring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSpring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview Webinar
Salesforce Developers
 

Similaire à AngularJS App In Two Weeks (20)

Hands-on Workshop: Intermediate Development with Heroku and Force.com
Hands-on Workshop: Intermediate Development with Heroku and Force.comHands-on Workshop: Intermediate Development with Heroku and Force.com
Hands-on Workshop: Intermediate Development with Heroku and Force.com
 
Building JavaScript Applications on the Salesforce1 Platform
Building JavaScript Applications on the Salesforce1 PlatformBuilding JavaScript Applications on the Salesforce1 Platform
Building JavaScript Applications on the Salesforce1 Platform
 
Lightning Web Components - A new era, René Winkelmeyer
Lightning Web Components - A new era, René WinkelmeyerLightning Web Components - A new era, René Winkelmeyer
Lightning Web Components - A new era, René Winkelmeyer
 
Singapore dev user group
Singapore   dev user groupSingapore   dev user group
Singapore dev user group
 
Lightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE EvolvedLightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE Evolved
 
ISV Lightning Webinar Series - Part 1 (December 1, 2015)
ISV Lightning Webinar Series - Part 1 (December 1, 2015)ISV Lightning Webinar Series - Part 1 (December 1, 2015)
ISV Lightning Webinar Series - Part 1 (December 1, 2015)
 
Building einstein analytics apps uk-compressed
Building einstein analytics apps   uk-compressedBuilding einstein analytics apps   uk-compressed
Building einstein analytics apps uk-compressed
 
Using Visualforce in Salesforce1
Using Visualforce in Salesforce1Using Visualforce in Salesforce1
Using Visualforce in Salesforce1
 
Look Ma, No Apex: Mobile Apps with RemoteObject and Mobile SDK
Look Ma, No Apex: Mobile Apps with RemoteObject and Mobile SDKLook Ma, No Apex: Mobile Apps with RemoteObject and Mobile SDK
Look Ma, No Apex: Mobile Apps with RemoteObject and Mobile SDK
 
APP Academy: Build Your First App (October 13, 2014)
APP Academy: Build Your First App (October 13, 2014)APP Academy: Build Your First App (October 13, 2014)
APP Academy: Build Your First App (October 13, 2014)
 
[MBF2] Plate-forme Salesforce par Peter Chittum
[MBF2] Plate-forme Salesforce par Peter Chittum[MBF2] Plate-forme Salesforce par Peter Chittum
[MBF2] Plate-forme Salesforce par Peter Chittum
 
Mobile pack developer webinar
Mobile pack developer webinarMobile pack developer webinar
Mobile pack developer webinar
 
Mobile pack developer webinar
Mobile pack developer webinarMobile pack developer webinar
Mobile pack developer webinar
 
Summer '15 Release Preview: Platform Feature Highlights
Summer '15 Release Preview: Platform Feature Highlights Summer '15 Release Preview: Platform Feature Highlights
Summer '15 Release Preview: Platform Feature Highlights
 
Spring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSpring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview Webinar
 
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam BarnetSandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
 
Forcelandia 2016 Wave App Development
Forcelandia 2016   Wave App DevelopmentForcelandia 2016   Wave App Development
Forcelandia 2016 Wave App Development
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
Building Mobile Apps on Salesforce Platform with Mobile SDK
Building Mobile Apps on Salesforce Platform with Mobile SDKBuilding Mobile Apps on Salesforce Platform with Mobile SDK
Building Mobile Apps on Salesforce Platform with Mobile SDK
 
Lightning Components Introduction
Lightning Components IntroductionLightning Components Introduction
Lightning Components Introduction
 

Plus de Peter Chittum

Plus de 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
 
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
 
Maths Week - About Computers, for Kids
Maths Week - About Computers, for KidsMaths Week - About Computers, for Kids
Maths Week - About Computers, for Kids
 
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
 
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
 
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
 
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
 
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
 

Dernier

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Dernier (20)

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

AngularJS App In Two Weeks

  • 1. Salesforce1 Events App on AngularJS in Two Weeks Peter Chittum Developer Evangelist salesforce.com @pchittum Adrian Smalley Lead Salesforce Architect Acumen Solutions @adriansmalley
  • 2. 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 any litigation, risks associated with completed and any 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 year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These 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.
  • 3. Peter Chittum Developer Evangelist @pchittum github.com/pchittum
  • 4. Adrian Smalley Lead Salesforce Architect - UK @adriansmalley
  • 5. 2 Min DEMO Adrian : EventFlex
  • 6. EventFlex Before we begin…. • This app is open source and an accelerator for those wishing to take it further. • It is hosted on github : https://github.com/adriansmalley/eventflex • Showcases cool features but isn’t quite production ready. You have been warned.
  • 7. Our Approach Adrian : Begin with the end in mind
  • 8. Timeline Acumen’s approach to custom SF1 App creation Initiate Define Build Deliver Launch 1 2 3 4 5 6 7 8 9 10 UX SF1 Config Angular App Data Layer Front end Dev
  • 9. Who and How?! The criticalness of UX and Wireframing Solution Team Tools ?! UX & BA Admin Angluar & SF DEV Google Docs Balsamiq Git Issues Github UX
  • 10. Step 1 : Persona’s, Design, Style, UX Adrian : Bringing user experience to the centre of app development
  • 11. Have the user at the heart and the start Thinking about User Experience from the beginning # 1 # 2 # 3 1. Personas 2. Stories 3. Prioritise Stories 4. User Flows 5. Wireframes 6. Design UX
  • 12. Begin with the end in Mind The criticalness of UX and Wireframing 4 Version of this screen before deciding Choosing Charts before development Single attempt at Build! UX
  • 13. Visualforce on Salesforce1 Peter : Connecting Angular, Salesforce1, and Visualforce
  • 14. Salesforce1 Mobile Extensible Hybrid Mobile App • Point and Click • Visualforce • Canvas • NEW! Lightning Components Salesforce1
  • 15. Salesforce1 + Visualforce • Publisher Action • Visualforce Tab • Mobile Card Salesforce1
  • 16. Your Visualforce Page in Salesforce1 <!-- Visualforce Basic Page Setup --> <apex:page docType="HTML-5.0" showHeader="false" sidebar="false" standardStylesheets="false" controller="EventFlexServices"> Salesforce1 <!-- use static resources --> <apex:includeScript value="{!URLFOR($Resource.efLibs,'angular/angular.min.js')}" /> ... <apex:stylesheet value="{!URLFOR($Resource.efLibs, 'bootstrap1/css/bootstrap.min.css')}"/>
  • 17. Angular App Architecture Peter : Angular in SFDC
  • 18. BASE HTMLPAGE App Structure APEX Classes JAVASCRIPT • APP STARTUP • DIRECTIVES • CONTROLLERS • SERVICES ANGULARJS MODULE LIBS CSS HTML VIEWS (PARTIALS) VISUALFORCEPAGE Static Resources Static Resources Static Resources Static Resources/Bundle AngularJS App
  • 19. Static Resource Mapping var staticItems = { 'efMainHTML' : "{!URLFOR($Resource.efMainHTML)}", 'efSessionHTML' : "{!URLFOR($Resource.efSessionHTML)}", ... 'getSessionTopics':'{!$RemoteAction.EventFlexServices.getSessionTopics}', 'getSessionSpeakers' : '{!$RemoteAction.EventFlexServices.getSessionSpeakers}’, ... }; AngularJS App
  • 20. The Components BOOTSTRAP(-SF1) ANGULARJS VISUALFORCE The “VAB” Stack AngularJS App
  • 21. Why AngularJS • Structured JS • Convention creates familiarity • Adaptable, Extensible • Big community • Enterprise ready AngularJS App
  • 22. AngularJS App Startup <div class="container-fluid" ng-app="eventflex"> <div ng-view="#" class="slide container"></div> </div> var eventFlex = angular.module('eventflex', ['ngRoute', 'ngAnimate', 'gantt']); App Name Included Modules AngularJS App
  • 23. AngularJS Page Views & Routing Page UI templates eventFlex.config(function($routeProvider) { $routeProvider .when('/', { templateUrl : staticItems['efMainHTML'], controller : 'MainCTRL' }) .when('/session/:id', {templateUrl : staticItems['efSessionHTML'], controller : 'SessionCTRL' }) }); Request URL JS Controller True File URL AngularJS App
  • 24. Bootstrap-SF1 Salesforce1 Theme for Twitter Bootstrap CSS Framework AngularJS App
  • 25. Data Access Peter : Getting data
  • 26. Data Access for Salesforce1 • Remote Object • @RemoteAction apex Methods • REST API for large requests Data Access
  • 27. AngularJS Services for Backend • Declare Service then Use Where Needed Data Access eventFlex.service('efSERVICES', function(){ return{ getAllEvents : function(callback){ ...service logic... }, getSessions : function(callback){ ...service logic… }... } }); eventFlex.controller('MainCTRL', ['$scope','efSERVICES'...,funtion($scope,efSERVICES,...{ ...controller logic... };
  • 28. Remote Object in Angular Service <apex:remoteObjects > <apex:remoteObjectModel name="Event__c" jsShorthand="evt” fields="Name,Id,OwnerId,Short_description__c,..."/> <apex:remoteObjectModel name="Session__c" jsShorthand="session" fields="Name,Id,Location_text__c,Short_description__c,Description__c,..."/> </apex:remoteObjectModel> </apex:remoteObjects> getEventDetails : function(eventId, callback){ var data = new SObjectModel.evt(); var whereOb = { where : {Id : {eq:eventId}}}; data.retrieve(whereOb,function(err, records){ //if failure if(err) alert(err.message); else { console.debug(records); callback(records[0]); } }); }, Data Access
  • 29. @RemoteAction in AngularJS Service getMyFriendsAttendance : function(eventId, callback){ Visualforce.remoting.Manager.invokeAction( staticItems['getMyFriendsAttendance'], eventId, function(result, event){ if( event.status ) { callback(result); } }); }, Data Access
  • 30. Components and Community Adrian : Power your productivity with the Angular Community
  • 31. Angular Community and Directives There is heaps of awesome open source out there • Using other peoples components in your app : – Saves you loads of time – Is often better tested – Often more widely tested (cross browsers etc) • It’s easy to search for components (directives) that will help you out. • We used : – Angular Gantt (http://angular-gantt.github.io/angular-gantt) – Angular Charts (https://github.com/chinmaymk/angular-charts.git) Front End
  • 32. Installing Apps / Directives Integrating other components • Adding to your app is super easy : 1. Install <apex:includeScript value="{!URLFOR($Resource.Angula rD3, 'd3-master/d3.min.js')}"/> <apex:includeScript value="{!URLFOR($Resource.Angula rChartsJS)}" /> 2. Inject var d3App = angular.module('d3App', ['ngRoute', 'angularCharts']); 3. Add to controller $scope.config = {} $scope.data = {} 4. Use Directive in Page <div ng-controller="d3CTRL"> <div data-ac-chart="'pie'" data-ac- data="data" data-ac-config=" config" class="chart"> <div> Front End
  • 33. Building the Page Adrian : UI development
  • 34. Understanding the Data Flow VISUALFORCE CONTROLLER DIRECTIVES SERVICES APEX Classes The Execution Cycle Front End 1. Page Loads 2. Angular Controller calls init() 3. Controller Calls the Services 4. Services calls APEX classes via @remoteAction 5. Data Returned from Apex to Services 6. Services Returns data to Controller 7. Controller Refreshes the page 8. VOLA!
  • 35. MVC for Javascript. Remarkably similar to APEX. APEX Controller Angular Controller public with sharing class efCharts { public Id eventId {get;set;} public list<events> evtList {get;set;} public pageReference getNewDashboard(){ return null; } } d3App.controller('d3CTRL', function($scope, chartServices, $routeParams) { $scope.eventId = $routeParams.id; $scope.events = []; $scope.refreshData = function(){ ... } } Visualforce Page HTML Page <apex:page controller="efCharts" > <apex:repeat value=”{!evtlist}” var=”e”> {!e.Name} </apex:repeat> </apex:page> <div ng-app="d3App"> <div ng-controller="d3CTRL"> <ul ng-repeat=”e in events”> <li>{{e.Name}}</li> </ul> </div> </div> Front End
  • 36. Bindings - putting stuff on the page • Output bindings are the simplest way to stamp data on your page using {{}} <span>{{Event.Start_Date__c}}</span> • However this prints out the wrong format so lets use a formatter. Magic. <span>{{Event.Start_Date__c | date : ‘dd-MM-yyyy’}}</span> [Works for Date, Number, Currency, Uppercase, Lowercase] • If we want a 2 way connection e.g. an input field we use ng-model which will refresh the page on change of this value. Amazing for live filtering. <input ng-model=”searchText”/> Front End
  • 37. Repeats, Repeats, Repeats • Repeats are key to delivering lists of data. They can be either Arrays OR Objects. <li ng-repeat=”item in items”>{{item.Name}}</li> <li ng-repeat=”(key, value) in items”>{{value.Name}}</li> • Angular Packs some serious punch with filters –Simple filter that searches for anything in the array <li ng-repeat=”item in items | filter: searchText”>{{item.Name}}</li> Front End –Restricted filter that searches for a field on an object <li ng-repeat=”item in items | filter: {name:searchText}”>{{item.Name}}</li> –Add in orderBy for maximum control<li ng-repeat=”item in items | filter: searchText | orderBy:’Name’”>{{item.Name}}</li>
  • 38. Directives & Partials • Directives are tags that allow you to create angular components. Directives can be reused thought out your app. • You need to specify how you want to register a directive Attribute or Tag: <span my-directive=””></span> or <my-directive></my-directive> • Key components of a directive include : –HTML template / Partial : specify how you want to display data –Scope : Specify which pieces of data you need –Link Function : specify how you want to interact with the component. • On your page now simply reference the directive and pass in the data <span my-directive=”” data-item=”dataitem”></span> Front End
  • 39. An Example 1. Use Attribute to get directive & replace original tag Front End 1. Allow dataItem to be passed in. NOTE you use data-item=”” in the HTML. 1. Template as HTML 1. Create a link function with new scope and allow access to the HTML element and attributes. Great for adding on-click events, jquery etc myapp.directive(‘myDirective’, function() { return { restrict: 'A', replace: true, scope: { dataItem:’=’ }, template: '<span>{{dataItem.name}}</span>', link: function (scope, element, attr){ scope.dataitem2 = ‘ABCD’ scope.resetValue = function(){ scope.dataItem = scope.dataitem2 } element.bind(‘click’, scope.resetValue); } };
  • 40. So the app in the end... Adrian : Recap
  • 41. EventFlex as a Solution Mapping the features to the UI Twitter Integration Chatter Service Cloud Salesforce1 Communities Force.com