Detroit ELEVATE Track 2

1,055 views

Published on

Advanced Workshop

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,055
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
43
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Check this again – find that transaction / average time stat
  • 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
  • We are going to start the day by talking about unit testing, and then in a bit SOQL. Because these are aspects of the platform which are really a dialtone, something we should be constantly evolving with.And yes, that’s a real bug. The first real bug.So if our new fictional job is to enhance this existing Warehouse application, how we write our unit tests are going to be very important.
  • So let’s talk about what some of your best practices are? Or if you’re brave, some of your worst?OK, let’s actually look at some really bad examples.
  • So to recap – Unit Tests should prove out not just code, but use cases. You should try to cover as much of your code as possible. And when should you test?
  • One theor
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • Indexed fields are fields tracked specifically by the database, and hence can lend to greater performance when your queries use them.
  • Apex can automatically create Maps from any SOQL result, and you can use that feature to either easily loop through the results or even to easily track the result in the map. For instance, the example here on the bottom would make it possible to find a specific contact in the result with one call from the map.
  • It’s also good to remember that you can pull children from the parent in one SOQL call. Let’s take a look at that in the Dev Console.SELECT Name, (SELECT Merchandise__r.Name from Line_Items__r) from Invoice__c LIMIT 5
  • You can also assign the SOQL result directly to a list, and then loop through that array. This allows you to quickly bulkify your code by generating loops and then performing any necessary DML when those loops are done.
  • One feature added recently to SOQL was the ability to use a readOnly annotation or flag to declare the results unusable in DML, but greatly expanding the number of results that can be handles. For instance, this visualforce page would normally only be able to handle an array of 1,000, but with readOnly that limit is relaxed to 10,000.
  • Some of the fields in the database are polymorphic, but until a few releases ago – SOQL didn’t really recognize that fact. Now that it does, you can cue specific results from those fields based on their Sobject type. Here’s an example in the Dev Console.SELECT Subject, TYPEOF What WHEN Account THEN Phone, NumberOfEmployees WHEN Opportunity THEN Amount, CloseDate ENDFROM Event
  • OFFSET allows you to create paginated results easily. The query on the left would give us the first 10 results, and the query on the right would give us the next 10. To see that in the Dev Console:SELECT NAME from Merchandise__c LIMIT 5 OFFSET 0SELECT NAME from Merchandise__c LIMIT 5 OFFSET 10(Or use Contact depending on the org)Now one key limit on OFFSET is that the maximum offset is 2000, so you’ll need to be paginating through a recordset smaller than that.
  • Aggregate searches allow a developer to do powerful mathematical searches against the database. In the example on the top here, you’ll get a count of merchandise by name for a specific invoice. Think of it like a highly customizable rollup field.The example on the bottom takes that same search, but shows you how it is split up. We’re summarizing an integer field, getting a child name field and then grouping it by that field. Here’s another example, where we can see how much a line item is worth by merchandise:SELECT SUM(Quantity__c) quantity, Merchandise__r.Name name from Line_Item__c Group By Merchandise__r.Name
  • The platform now supports geolocation. In order to do a dynamic search, like above, you’ll need to construct the string and then use a dynamic query. Using these queries, you could easily gather data based on physical location, for instance if you wanted to find the contact closest to where you parked.Here’s an example in the dev console:SELECT Name FROM Account WHERE DISTANCE(Location__c, GEOLOCATION(37.7945391,-122.3947166), 'mi') < 1
  • So SOSL isn’t exactly new – we’ve had in the system for some time. But if you are trying to search across different Sobject types, nothing beats it. Here we can find Tim even if he is a contact or account. Let’s look at an example in the Dev Console:FIND {Tim} IN Name Fields RETURNING lead(id, name), contact(id, name, LastModifiedDate), account(id, name, LastModifiedDate), user(id, name, LastModifiedDate) LIMIT 5
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • Explain the ID trick, - for SOQL injection protection
  • Explain the ID trick, - for SOQL injection protection
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • Controller testing should also include page reference asserts if you are moving from page to page
  • We’re used to thinking about Visualforce as a component based library, and that let’s us create HTML based interfaces very quickly and easily by binding those components to data. But what about using those components to mix and match Visualforce across your instance?
  • For instance, you can use Visualforce to create very custom dashboards, and then put those on your homepage. Here’s an example I’ve got with the Warehouse app, which is showing recently created Invoices:( /home/home.jsp )Now if I click into one of those Invoices, we’re also seeing visualforce.
  • Because, and this is probably one of the more common use cases for Visualforce, anything with a Standard Controller can be used in place of the standard list, view, edit style pages. On this page, I’m still displaying the page layout via the detail component, but we wanted to be able to leverage a new footer across different detail pages(show WarehouseDetail
  • And we’re keeping that new detail consistent by using a template. We can define our inserts, and then define our content. This allows us to maintain a lot of different look and feels across different object types, but controlling the parts that will the same in one place.
  • And of course, as we customize that layout, we can create custom components which can take incoming attributes and then render what we need. For instance, in my footer I am using a visualization jQuery plugin called isotope, which allows us to view the line items in a very different way than the related list. You’ll see more about jQuery later.
  • And of course, if I want that Visualforce in the middle of my layout, I can use a StandardController to embed that right into it. In fact, in this layout – this section is not being generated here on Salesforce.
  • It’s actually using Canvas, which allows me to easily put third part applications into Salesforce in a secure manner.
  • For instance, maybe I have a large internal intranet applications. I don’t want to port all that functionality into Salesforce, but I do want to be able to integrate this one interface.
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • Apex controllers are probably the most common use case for the language, but triggers merit a second place.
  • And with all of those potentials triggers in your system, they can easily get out of hand. There are a few best practices people have found to make them more maintainable.First, consider having only one trigger per object. Within the trigger class itself, break out every possible event, before and after, and start putting system.debugs around them. At the very least, this will make it very easy to track down in debug logs where the logic is getting fired.Second, consider handing off the actual logic to delegate classes. Send them the current scope of the trigger and let them sort it out. This will neatly divide the functionality that your trigger is trying to accomplish.
  • A delegate also gives you more breathing room. Look at all the variables we are using to properly track what this delegate wants to do – if you started stacking all the logic into the trigger itself, this will start to get unruly really fast. Don’t let your triggers become a battleground, they should be more like highways.
  • Another trick is using static variables in another class to track progress in your trigger. Changes to these flags will be visible for the span of the trigger context. So if, for instance, another process kicks off your trigger logic a second time, and you don’t want it to – you could swap the first flag here to true, and then not execute any logic if that flag is true.
  • And remember one of the more powerful uses of triggers is in association with Chatter. Let’s take a look at a Force.com labs app, Chatter Blacklist, which illustrates this very well.
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • Self Service case structure by Email
  • Update this subtitle
  • How does privacy work with Chatter? Can you accidentally share a record I’m not supposed to see?
  • statue
  • Detroit ELEVATE Track 2

    1. 1. Advanced Developer WorkshopJoshua BirkDeveloper Evangelist@joshbirkjoshua.birk@salesforce.comGordon JacksonSolution Architectgjackson@salesforce.com
    2. 2. Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-lookingstatements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions provesincorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-lookingstatements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projectionsof subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management forfuture operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments andcustomer 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 newfunctionality for our service, our new business model, our past operating losses, possible fluctuations in our operating results and rate ofgrowth, interruptions or delays in our Web hosting, breach of our security measures, risks associated with possible mergers andacquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivateour employees and manage our growth, new releases of our service and successful customer deployment, our limited history resellingnon-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that couldaffect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal quarter endedJuly 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 maynot be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features thatare currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
    3. 3. ETHERNETONTABLEPromo code:salesforce13http://bit.ly/elevate_adv
    4. 4. InteractiveQuestions? Current projects? Feedback?
    5. 5. 1,000,000Salesforce Platform Developers
    6. 6. 9 BillionAPI calls last month
    7. 7. 2.5xIncreased demand for Force.com developers
    8. 8. YOUare the makers
    9. 9. BETA TESTINGWarning: We’re trying something new
    10. 10. Editor Of ChoiceFor the Eclipse fans in the room
    11. 11. Warehouse Data ModelMerchandiseName Price InventoryPinot $20 15Cabernet $30 10Malbec $20 20Zinfandel $10 50InvoiceNumber Status Count TotalINV-01 Shipped 16 $370INV-02 New 20 $200Invoice Line ItemsInvoice Line Merchandise UnitsSoldUnit Price ValueINV-01 1 Pinot 1 15 $20INV-01 2 Cabernet 5 10 $150INV-01 3 Malbec 10 20 $200INV-02 1 Pinot 20 50 $200
    12. 12. http://developer.force.com/join
    13. 13. Apex Unit TestingPlatform level support for unit testing
    14. 14. Unit Testing Assert all use cases Maximize code coverage Test early, test ofteno Logic without assertionso 75% is the targeto Test right before deployment
    15. 15. Test Driven Development
    16. 16. Testing Context// this is where the context of your test beginsTest.StartTest();//execute future calls, batch apex, scheduled apex// this is where the context endsText.StopTest();System.assertEquals(a,b); //now begin assertions
    17. 17. Testing Permissions//Set up userUser u1 = [SELECT Id FROM UserWHERE Alias=auser];//Run As U1System.RunAs(u1){//do stuff only u1 can do}
    18. 18. Static Resource DataList<Invoice__c> invoices = Test.loadData(Invoice__c.sObjectType,InvoiceData);update invoices;
    19. 19. Mock HTTP@isTestglobal class MockHttp implements HttpCalloutMock {global HTTPResponse respond(HTTPRequest req) {// Create a fake responseHttpResponse res = new HttpResponse();res.setHeader(Content-Type, application/json);res.setBody({"foo":"bar"});res.setStatusCode(200);return res;}}
    20. 20. Mock HTTP@isTestprivate class CalloutClassTest {static void testCallout() {Test.setMock(HttpCalloutMock.class, new MockHttp());HttpResponse res = CalloutClass.getInfoFromExternalService();// Verify response received contains fake valuesString actualValue = res.getBody();String expectedValue = {"foo":"bar"};System.assertEquals(actualValue, expectedValue);}}
    21. 21. Unit Testing Tutorialhttp://bit.ly/elevate_adv
    22. 22. SOQLSalesforce Object Query Language
    23. 23. Indexed Fields• Primary Keys• Id• Name• OwnerIdUsing a query with two or more indexed filters greatly increases performance• Audit Dates• Created Date• Last Modified Date• Foreign Keys• Lookups• Master-Detail• CreatedBy• LastModifiedBy• External ID fields• Unique fields• Fields indexed bySaleforce
    24. 24. SOQL + MapsMap<Id,Id> accountFormMap = new Map<Id,Id>();for (Client_Form__c form : [SELECT ID, Account__c FROMClient_Form__cWHERE Account__cin :accountFormMap.keySet()]){accountFormMap.put(form.Account__c, form.Id);}Map<ID, Contact> m = new Map<ID, Contact>([SELECT Id, LastName FROM Contact]);
    25. 25. Child RelationshipsList<Invoice__c> invoices = [SELECT Name,(SELECT Merchandise__r.Namefrom Line_Items__r)FROM Invoice__c];List<Invoice__c> invoices = [SELECT Name,(SELECT Child_Field__cfrom Child_Relationship__r)FROM Invoice__c];
    26. 26. SOQL Loopspublic void massUpdate() {for (List<Contact> contacts: [SELECT FirstName, LastNameFROM Contact]){for(Contact c : contacts) {if (c.FirstName == Barbara &&c.LastName == Gordon) {c.LastName = Wayne;}}update contacts;}}
    27. 27. ReadOnly<apex:page controller="SummaryStatsController" readOnly="true"><p>Here is a statistic: {!veryLargeSummaryStat}</p></apex:page>public class SummaryStatsController {public Integer getVeryLargeSummaryStat() {Integer closedOpportunityStats =[SELECT COUNT() FROM Opportunity WHEREOpportunity.IsClosed = true];return closedOpportunityStats;}}
    28. 28. SOQL PolymorphismList<Case> cases = [SELECT Subject,TYPEOF WhatWHEN Account THEN Phone, NumberOfEmployeesWHEN Opportunity THEN Amount, CloseDateENDFROM Event];
    29. 29. OffsetSELECT NameFROM Merchandise__cWHERE Price__c > 5.0ORDER BY NameLIMIT 10OFFSET 0SELECT NameFROM Merchandise__cWHERE Price__c > 5.0ORDER BY NameLIMIT 10OFFSET 10
    30. 30. AggregateResultList<AggregateResult> res = [SELECT SUM(Line_Item_Total__c) total,Merchandise__r.Name namefrom Line_Item__cwhere Invoice__c = :idGroup By Merchandise__r.Name];List<AggregateResult> res = [SELECT SUM(INTEGER FIELD) total,Child_Relationship__r.Name namefrom Parent__cwhere Related_Field__c = :idGroup By Child_Relationship__r.Name];
    31. 31. GeolocationString q =SELECT ID, Name, ShippingStreet, ShippingCity from Account ;q+= WHERE DISTANCE(Location__c,GEOLOCATION(+String.valueOf(lat);q+= ,+String.valueOf(lng)+), mi);q+= < 100;accounts = Database.query(q);
    32. 32. SOSLList<List<SObject>> allResults =[FIND Tim IN Name Fields RETURNINGlead(id, name, LastModifiedDateWHERE LastModifiedDate > :oldestDate),contact(id, name, LastModifiedDateWHERE LastModifiedDate > :oldestDate),account(id, name, LastModifiedDateWHERE LastModifiedDate > :oldestDate),user(id, name, LastModifiedDateWHERE LastModifiedDate > :oldestDate)LIMIT 5];
    33. 33. Visualforce ControllersApex for constructing dynamic pages
    34. 34. ViewstateHashed information block to track server side transports
    35. 35. Reducing Viewstate//Transient data that does not get sent back,//reduces viewstatetransient String userName {get; set;}//Static and/or private vars//also do not become part of the viewstatestatic private integer VERSION_NUMBER = 1;
    36. 36. Reducing Viewstate//Asynchronous JavaScript callback. No viewstate.//RemoteAction is static, so has no access to Controller context@RemoteActionpublic static Account retrieveAccount(ID accountId) {try {Account a = [SELECT ID, Name from ACCOUNTWHERE Id =:accountID LIMIT 1];return a;} catch (DMLException e) {return null;}}
    37. 37. Handling Parameters//check the existence of the query parameterif(ApexPages.currentPage().getParameters().containsKey(„id‟)) {try {Id aid = ApexPages.currentPage().getParameters().get(„id‟);Account a =[SELECT Id, Name, BillingStreet FROM AccountWHERE ID =: aid];} catch(QueryException ex) {ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, ex.getMessage()));return;}}
    38. 38. SOQL InjectionString account_name = ApexPages.currentPage().getParameters().get(name);account_name = String.escapeSingleQuotes(account_name);List<Account> accounts = Database.query(SELECT ID FROMAccount WHERE Name = +account_name);
    39. 39. Cookies//Cookie =//new Cookie(String name, String value, String path,// Integer milliseconds, Boolean isHTTPSOnly)public PageReference setCookies() {Cookie companyName =new Cookie(accountName,TestCo,null,315569260,false);ApexPages.currentPage().setCookies(new Cookie[]{companyName});return null;}public String getCookieValue() {return ApexPages.currentPage().getCookies().get(accountName).getValue();}
    40. 40. Inheritance and Constructionpublic with sharing class PageControllerimplements SiteController {public PageController() {}public PageController(ApexPages.StandardController stc) {}
    41. 41. Controlling Redirect//Stay on same pagereturn null;//New page, no ViewstatePageReference newPage = new Page.NewPage();newPage.setRedirect(true);return newPage;//New page, retain ViewstatePageReference newPage = new Page.NewPage();newPage.setRedirect(false);return newPage;
    42. 42. Unit Testing Pages//Set test pageTest.setCurrentPage(Page.VisualforcePage);//Set test dataAccount a = new Account(Name=TestCo);insert a;//Set test paramsApexPages.currentPage().getParameters().put(id,a.Id);//Instatiate ControllerSomeController controller = new SomeController();//Make assertionSystem.assertEquals(controller.AccountId,a.Id)
    43. 43. Non-HTML Visualforce Tutorialhttp://bit.ly/elevate_advhttp://bit.ly/elevate_demos_adv
    44. 44. Visualforce ComponentsEmbedding content across User Interfaces
    45. 45. Visualforce Dashboards<apex:page controller="retrieveCase"tabStyle="Case"><apex:pageBlock>{!contactName}s Cases<apex:pageBlockTable value="{!cases}"var="c"><apex:column value="{!c.status}"/><apex:column value="{!c.subject}"/></apex:pageBlockTable></apex:pageBlock></apex:page>Custom ControllerDashboard Widget
    46. 46. Page OverridesSelect OverrideDefine Override
    47. 47. Templates<apex:page controller="compositionExample"><apex:form ><apex:insert name=”header" /><br /><apex:insert name=“body" />Layout insertsDefine withComposition<apex:composition template="myFormComposition<apex:define name=”header"><apex:outputLabel value="Enter your favorite m<apex:inputText id=”title" value="{!mealField}"</apex:define><h2>Page Content</h2>
    48. 48. <apex:component controller="WarehouseAccounts<apex:attribute name="lat" type="Decimal" descripQuery" assignTo="{!lat}"/><apex:attribute name="long" type="Decimal" descGeolocation Query" assignTo="{!lng}"/><apex:pageBlock >Custom ComponentsDefine AttributesAssign to Apexpublic with sharing class WarehouseAccountsContpublic Decimal lat {get; set;}public Decimal lng {get; set;}private List<Account> accounts;public WarehouseAccountsController() {}
    49. 49. Page EmbedsStandard ControllerEmbed in Layout<apex:page StandardController=”Account”showHeader=“false”<apex:canvasAppdeveloperName=“warehouseDev”applicationName=“procure”
    50. 50. CanvasFramework for using third party apps within Salesforce
    51. 51. Any Language, Any Platform• Only has to be accessible from the user’s browser• Authentication via OAuth or Signed Response• JavaScript based SDK can be associated with any language• Within Canvas, the App can make API calls as the current user• apex:CanvasApp allows embedding via VisualforceCanvas Anatomy
    52. 52. Geolocation Component Tutorialhttp://bit.ly/elevate_adv
    53. 53. jQuery IntegrationVisualforce with cross-browser DOM and event control
    54. 54. jQuery ProjectsDOM ManipulationEvent ControlUI PluginsMobile Interfaces
    55. 55. noConflict() + ready<script>j$ = jQuery.noConflict();j$(document).ready(function() {//initialize our interface});</script> Keeps jQuery out of the $ function Resolves conflicts with existing libs Ready event = DOM is Ready
    56. 56. jQuery Functionsj$(#accountDiv).html(New HTML); Call Main jQuery function Define DOM with CSS selectors Perform actions via base jQuery methods or plugins
    57. 57. DOM ControlaccountDiv = j$(id*=idname);accountDiv.hide();accountDiv.hide.removeClass(bDetailBlock);accountDiv.hide.children().show();//make this make sense Call common functions Manipulate CSS Directly Interact with siblings and children Partial CSS Selectors
    58. 58. Event Controlj$(".pbHeader").click(function() {j$(".pbSubsection”).toggle();}); Add specific event handles bound to CSS selectors Handle specific DOM element via this Manipulate DOM based on current element, siblings or children
    59. 59. jQuery Plugins iCanHaz jqPlot cometD SlickGrid, jqGridMoustache compatible client side templatesFree charting libraryFlexible and powerful grid widgetsBayeux compatible Streaming API client
    60. 60. Streaming API Tutorialhttp://bit.ly/elevate_adv
    61. 61. LUNCH:Room 119To the left, down the stairs
    62. 62. Apex TriggersEvent based programmatic logic
    63. 63. Controlling Flowtrigger LineItemTrigger on Line_Item__c (before insert,before update) {//separate before and afterif(Trigger.isBefore) {//separate eventsif(Trigger.isInsert) {System.debug(„BEFORE INSERT‟);DelegateClass.performLogic(Trigger.new);//
    64. 64. Delegatespublic class BlacklistFilterDelegate{public static Integer FEED_POST = 1;public static Integer FEED_COMMENT = 2;public static Integer USER_STATUS = 3;List<PatternHelper> patterns {set; get;}Map<Id, PatternHelper> matchedPosts {set; get;}public BlacklistFilterDelegate(){patterns = new List<PatternHelper>();matchedPosts = new Map<Id, PatternHelper>();preparePatterns();}
    65. 65. Static Flagspublic with sharing class AccUpdatesControl {// This class is used to set flag to prevent multiple callspublic static boolean calledOnce = false;public static boolean ProdUpdateTrigger = false;}
    66. 66. Chatter Triggerstrigger 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;}elsef.RegexValue__c = RegexHelper.toRegex(f.Word__c,f.Match_Whole_Words_Only__c);}}
    67. 67. De-duplication Trigger Tutorialhttp://bit.ly/elevate_adv
    68. 68. Scheduled ApexCron-like functionality to schedule Apex tasks
    69. 69. Schedulable Interfaceglobal with sharing class WarehouseUtil implements Schedulable {//General constructorglobal WarehouseUtil() {}//Scheduled executeglobal void execute(SchedulableContext ctx) {//Use static method for checking dated invoicesWarehouseUtil.checkForDatedInvoices();}
    70. 70. Schedulable InterfaceSystem.schedule(testSchedule,0 0 13 * * ?,new WarehouseUtil());Via ApexVia Web UI
    71. 71. Batch ApexFunctionality for Apex to run continuously in the background
    72. 72. Batchable Interfaceglobal with sharing class WarehouseUtilimplements Database.Batchable<sObject> {//Batch execute interfaceglobal Database.QueryLocator start(Database.BatchableContext BC){//setup SOQL for scope}global void execute(Database.BatchableContext BC,List<sObject> scope) {//Execute on current scope}global void finish(Database.BatchableContext BC) {//Finish and clean up context}
    73. 73. Unit TestingTest.StartTest();ID batchprocessid = Database.executeBatch(new WarehouseUtil());Test.StopTest();
    74. 74. Asynchronous Apex Tutorial
    75. 75. Apex EndpointsExposing Apex methods via SOAP and REST
    76. 76. OAuthIndustry standard method of user authentication
    77. 77. RemoteApplicationSalesforcePlatformSends App CredentialsUser logs in,Token sent to callbackConfirms tokenSend access tokenMaintain session withrefresh tokenOAuth2 Flow
    78. 78. Apex SOAPglobal class MyWebService {webService static Id makeContact(String lastName, Account a) {Contact c = new Contact(lastName = Weissman,AccountId = a.Id);insert c;return c.id;}}
    79. 79. Apex REST@RestResource(urlMapping=/CaseManagement/v1/*)global with sharing class CaseMgmtService{@HttpPostglobal 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/
    80. 80. Apex EmailClasses to handle both incoming and outgoing email
    81. 81. Outgoing EmailMessaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();String body = count+ closed records older than 90 days have been deleted;//Set addresses based on labelmail.setToAddresses(Label.emaillist.split(,));mail.setSubject ([Warehouse] Dated Invoices);mail.setPlainTextBody(body);//Send the emailMessaging.SendEmailResult [] r =Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
    82. 82. Incoming Emailglobal class PageHitsController implements Messaging.InboundEmailHandler {global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,Messaging.InboundEnvelope env){if(email.textAttachments.size() > 0) {Messaging.InboundEmail.TextAttachment csvDoc =email.textAttachments[0];PageHitsController.uploadCSVData(csvDoc.body);}Messaging.InboundEmailResult result = newMessaging.InboundEmailResult();result.success = true;return result;}
    83. 83. Incoming EmailDefine ServiceLimit Accepts
    84. 84. Custom Endpoint Tutorialhttp://bit.ly/elevate_adv
    85. 85. Team DevelopmentTools for teams and build masters
    86. 86. Metadata APIAPI to access customizations to the Force.com platform
    87. 87. Migration ToolAnt based tool for deploying Force.com applications
    88. 88. Continuous IntegrationSourceControlSandboxCI ToolDEFailNotificationsDevelopment Testing
    89. 89. Tooling APIAccess, create and edit Force.com application code
    90. 90. Polyglot FrameworkPaaS allowing for the deployment of multiple languages
    91. 91. Heroku Integration Tutorialhttp://bit.ly/elevate_adv
    92. 92. Double-click to enter titleDouble-click to enter textThe Wrap Up
    93. 93. check inbox ||http://bit.ly/elevatela13
    94. 94. Double-click to enter titleDouble-click to enter text@forcedotcom@joshbirk@metadaddy#forcedotcom
    95. 95. Double-click to enter titleDouble-click to enter textJoin ADeveloper User Grouphttp://bit.ly/fdc-dugsLA DUG:http://www.meetup.com/Los-Angeles-Force-com-Developer-Group/Leader: Nathan Pepper
    96. 96. Double-click to enter titleDouble-click to enter textBecome ADeveloper User Group LeaderEmail:April Nassi<anassi@salesforce.com>
    97. 97. Double-click to enter titleDouble-click to enter texthttp://developer.force.comhttp://www.slideshare.net/inkless/elevate-advanced-workshop
    98. 98. simplicityis the ultimateform ofsophisticationDa Vinci
    99. 99. Thank YouJoshua BirkDeveloper Evangelist@joshbirkjoshua.birk@salesforce.comMatthew ReiserSolution Architect@Matthew_Reisermreiser@salesforce.com

    ×