Skip to content

Instantly share code, notes, and snippets.

@sbob-sfdc
sbob-sfdc / index.html
Created September 5, 2012 20:23
Workshop 303, Final index.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<!-- include jquery mobile -->
<link rel="stylesheet" href="jquery/jquery.mobile-1.0b2.min.css" />
<script src="jquery/jquery-1.6.2.min.js"></script>
<script src="jquery/jquery.mobile-1.0b2.min.js"></script>
@sbob-sfdc
sbob-sfdc / data.csv
Created September 5, 2012 19:25
Workshop 101, Tutorial 6, Step 1, Data File
Merchandise Name Price Quantity
17 Inch Monitor 99 200
21 Inch Monitor 129 200
25 Inch Monitor 179 200
@sbob-sfdc
sbob-sfdc / HandleOrderUpdate.cls
Created September 2, 2012 23:55
Workshop 203, Tutorial 3, Step 5, Apex
trigger HandleOrderUpdate on Invoice__c (after update) {
// Create a map of IDs to all of the *old* versions of sObjects
// updated by the call that fires the trigger.
Map<ID, Invoice__c> oldMap =
new Map<ID, Invoice__c>(Trigger.old);
// Create an empty list of Ids
List<Id> invoiceIds = new List<Id>();
@sbob-sfdc
sbob-sfdc / Integration.cls
Created September 2, 2012 23:53
Workshop 203, Tutorial 3, Step 2, Apex
public class Integration {
// The ExternalOrder class holds a string and integer
// received from the external fulfillment system.
public class ExternalOrder {
public String id {get; set;}
public Integer order_number {get; set;}
}
@sbob-sfdc
sbob-sfdc / MobileInventory.page
Created September 2, 2012 23:52
Workshop 202, Tutorial 3, Step 4, Visualforce
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="Merchandise__c" extensions="MobileInventoryExtension" recordSetVar="products">
<!-- stylesheets and scripts, from CDN (use local files in production) -->
<apex:stylesheet value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"/>
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.js"/>
<head>
<title>Mobile Inventory</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script>
@sbob-sfdc
sbob-sfdc / MobileInventoryExtension.cls
Created September 2, 2012 23:51
Workshop 202, Tutorial 3, Step 3, Apex
public class MobileInventoryExtension {
// Constructors. Needed to use as an extension.
public MobileInventoryExtension(ApexPages.StandardController c) {}
public MobileInventoryExtension(ApexPages.StandardSetController c) {}
// Remote Action function lets JavaScript call Apex directly
// method to update a given Merchandise record passed in from a Visualforce page JavaScript function
@RemoteAction
public static String updateMerchandiseItem(String productId, Integer newInventory) {
@sbob-sfdc
sbob-sfdc / MobileInventory.page
Created September 2, 2012 23:50
Workshop 202, Tutorial 3, Step 1, Visualforce
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="Merchandise__c" recordSetVar="products">
<!-- stylesheets and scripts, from CDN (use local files in production) -->
<apex:stylesheet value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"/>
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.js"/>
<body>
<!-- Main page, to display list of Merchandise once app starts -->
<div data-role="page" data-theme="b" id="mainpage">
@sbob-sfdc
sbob-sfdc / MobileInventory.page
Created September 2, 2012 23:48
Workshop 202, Tutorial 2, Step 3, Visualforce
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="Merchandise__c" recordSetVar="products">
<!-- stylesheets and scripts, from CDN (use local files in production) -->
<apex:stylesheet value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"/>
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.js"/>
<body>
<!-- Main page, to display list of Merchandise once app starts -->
<div data-role="page" data-theme="b" id="mainpage">
@sbob-sfdc
sbob-sfdc / MobileInventory.page
Created September 2, 2012 23:47
Workshop 202, Tutorial 2, Step 1, Visualforce
<apex:page standardStylesheets="false" showHeader="false" sidebar="false">
<!-- stylesheets and scripts, from CDN (use local files in production) -->
<apex:stylesheet value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"/>
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.js"/>
<h1>Mobile Inventory</h1>
</apex:page>
@sbob-sfdc
sbob-sfdc / TestDeleteRestrictInvoice.cls
Created September 2, 2012 23:42
Workshop 201, Tutorial 6, Step 1, Apex
@isTest
private class TestDeleteRestrictInvoice {
// Invoice generator, with or without a Line Item
static Invoice__c createNewInvoice(Boolean withLineItem) {
// Create test Invoice and insert it into the database
Invoice__c invoice = new Invoice__c();
insert invoice;
// Create test Line Item and insert it into the database, if withLineItem == true