Skip to content

Instantly share code, notes, and snippets.

Andrew Fawcett afawcett

Block or report user

Report or block afawcett

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
afawcett / gist:11156378
Created Apr 21, 2014
Attempt to create Standard Pricebook2 via JSON deserialize... fail sadly...
View gist:11156378
private with sharing class TestPricebook {
@IsTest private static void testPricebook()
System.assertEquals(0, [select Id from Pricebook2 where IsStandard = true].size());
Pricebook2 pb = (Pricebook2) JSON.deserialize('{"Name":"Standard", "IsStandard":"true"}', Pricebook2.class);
System.assertEquals(true, pb.IsStandard);
insert pb;
System.assertEquals(1, [select Id from Pricebook2 where IsStandard = true].size());
afawcett / Opportunities.cls
Created Jun 20, 2014
Preview of FLS Support in Domain Layer (see comments below)
View Opportunities.cls
public with sharing class Opportunities extends fflib_SObjectDomain
public Opportunities(List<Opportunity> sObjectList)
// Domain classes are initialised with lists to enforce bulkification throughout
public override void onApplyDefaults()
afawcett / OpportunitiesSelectorAfter
Last active Aug 29, 2015
Preview of QueryFactory, CRUD Security and FLS in Selector Layer (see comments below)
View OpportunitiesSelectorAfter
public with sharing class OpportunitiesSelector extends fflib_SObjectSelector
public List<Schema.SObjectField> getSObjectFieldList()
return new List<Schema.SObjectField> {
afawcett / build.xml
Created Nov 16, 2014
ev3force build script...
View build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="ev3" default="clean" basedir=".">
<property name="environment" value="EV3" />
<property name="project" value="ev3force"/>
<property name="version" value="0.1"/>
<property name="base.dir" value="." />
<property name="src" location="src"/>
<property name="lib" location="${base.dir}/lib" />
afawcett / XAVWebServices.wsdl
Created Nov 5, 2012
Apex Friendly Version of UPS XAV Service
View XAVWebServices.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<!-- UPS XAV Service WSDL Release Date Dec 29, 2007 -->
<!-- Copyright 2007-2008 United Parcel Service of America, Inc. All rights reserved. -->
<wsdl:definitions xmlns:wsdl="" xmlns:soap="" xmlns:xsd="" xmlns:error="" xmlns:upss="" xmlns:xav="" xmlns:tns="" targetNamespace="">
<!-- This schema defines the UPS Security header used for authorization purposes -->
<xsd:schema targetNamespace="" xmlns:upss="" xmlns:xsd="" elementFormDefault="qualified">
<xsd:element name="UPSSecurity">
afawcett / gist:4112895
Created Nov 19, 2012
Sample Export from SObjectDataLoader
View gist:4112895
"RecordSetBundles": [
"Records": [
"attributes": {
"type": "ObjectA__c",
"url": "/services/data/v26.0/sobjects/ObjectA__c/a00d0000007kUmsAAE"
"CreatedDate": "2012-11-19T18:32:50.000+0000",
afawcett / SomeClassA.cls
Created Feb 2, 2013
Sample code used to test a prototype Apex Analysis tool using the new Spring'13 Tooling API.
View SomeClassA.cls
public class SomeClassA
public static void someMethod()
public static void someOtherMethod()
View SessionsController.cls
public with sharing class SessionController {
public List<Session__c> lstSessions {get;set;}
public SessionController()
lstSessions = [select Id, Session_Status__c, GL_Department__c, Quantity__c, Unit_Cost__c from Session__c];
public PageReference createNewSession()
View myClass.cls
global class myClass
global class wrapperClass
public String name {get; set;}
public Account account {get; set;}
public wrapperClass()
account = new Account();
afawcett / TestA.cls
Created May 5, 2013
Reproduction of Salesforce code coverage bug.
View TestA.cls
public class TestA {
public TestA()
public class TestB
public Integer doSomething()
Integer x = 1;
You can’t perform that action at this time.