Skip to content

Instantly share code, notes, and snippets.

View britishboyindc's full-sized avatar

Peter Churchill britishboyindc

View GitHub Profile
trigger Employee_Demo on Employee__c (after insert, after update) {
//Create a map of the leaves for each Gender/Status Combo. Consider a setting for this
Map<String, List<String> > LeaveTypeMap = new Map<String, List<String> > ();
LeaveTypeMap.put('Female:Full Time', new List<String>{'Maternity Leave','Annual Leave','Personal Leave','Unpaid Leave'});
LeaveTypeMap.put('Male:Full Time', new List<String>{'Paternity Leave','Annual Leave','Personal Leave','Unpaid Leave'});
LeaveTypeMap.put('Female:Part Time', new List<String>{'Unpaid Leave'});
LeaveTypeMap.put('Male:Part Time', new List<String>{'Unpaid Leave'});
//Create list to hold new leave records
List<Leave__c> LeavestoCreate = new List<Leave__c> ();
//Is this an insert? If so, just create records
List<ApexClass> ac = [select Id, name, body from ApexClass where NamespacePrefix = NULL ];
integer i = 0;
for (ApexClass actemp: ac) {
if (actemp.body.contains( '@isTest') ) {
i++;
}
}
system.debug(i + ' classes are Tests');
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<appender name="fileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${java.io.tmpdir}/sdl.log" />
<param name="Append" value="true" />
<param name="MaxFileSize" value="100KB" />
<param name="MaxBackupIndex" value="1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
@britishboyindc
britishboyindc / gist:ca03b81c1167c2ac5fd3
Created September 30, 2015 20:08
svg#close causing JS error
html += '<tr><td><button class="slds-button slds-button--icon-bare removeKWRow"><svg aria-hidden="true" class="slds-button__icon slds-button__icon--large">';
html += '<use xlink:href="{!URLFOR($Resource.SLDS090,'/assets/icons/utility-sprite/svg/symbols.svg#close')}"></use>';
html +='<span class="slds-assistive-text">close</span></button></td>';
html += '<td>' + value.AccountName + '</td>';
html += '<td class="hiderow">' + value.AccountId + '</td>';
html += '<td class="hiderow">' + value.KnowWhoId + '</td>';
html += '<td>';
@britishboyindc
britishboyindc / Test Script
Created May 22, 2014 02:48
Associate Contact with no Account Id to Bucket Account
@isTest
private class ContactAssociateAccount_TEST {
@isTest
private static void testblankaccountid() {
//First test when no Account exists
Contact testc = new Contact (LastName = 'Test Contact 1');
insert testc;
@britishboyindc
britishboyindc / gist:8447044
Created January 15, 2014 23:43
Twilio Message List
This worked for me:
Map<String, String> params = new Map<String, String> ();
TwilioRestClient client = TwilioAPI.getDefaultClient();
TwilioMessageList als = new TwilioMessageList(client, params);
als.setRequestAccountSid('XXX'); //put Accound Sid here
for (TwilioMessage msg: als.getPageData()) {
system.debug('###' + msg.getProperty('body'));
}
@britishboyindc
britishboyindc / gist:8428614
Created January 15, 2014 00:24
Adding Feed Item into a Chatter Feed of Opportunity (source) object for a new Grant Record (Target)
Opportunity opty = new Opportunity(Id = '006i000000A0T3t');
Grant_Management__c grd = new Grant_Management__c(Name = 'Test 123');
insert grd;
ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
ConnectApi.TextSegmentInput textSegment;
ConnectApi.LinkSegmentInput linkSegment;
messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();