Skip to content

Instantly share code, notes, and snippets.

View mtetlow's full-sized avatar

Mike "Mikename" Tetlow mtetlow

View GitHub Profile
<apex:page standardController="Opportunity">
<iframe src="/apex/TASKRAY__trhomepagewidget" seamless="seamless" style="width:100%; min-height:464px;" frameborder="0"></iframe>
</apex:page>
@mtetlow
mtetlow / fls
Created February 27, 2014 01:23
//Usage
...stuff
allChildren = trController.stripFLSFields('update', allChildren);
update allChildren;
..morestuff
//Method
public static List<sObject> stripFLSFields(String operation, List<sObject> newRecords){
List<sObject> returnList = new List<sObject>();
if(newRecords.size()>0){
@mtetlow
mtetlow / gist:9601548
Created March 17, 2014 15:37
bootstrap modal centering and resizing
$j('.modal').on('show.bs.modal', function(e) {
var modal = $j(this);
var modalContent = $j(this).find('.modal-content');
var modalDialog = $j(this).find('.modal-dialog');
//If the modal is too tall, resize it
if($j(modalDialog).height()>=$j(window).height()){
$j(modalDialog).height($j(window).height()-20);
}
//If the modal is too wide, resize it
if($j(modalDialog).width()>=$j(window).width()){
@RemoteAction
global static Boolean addUserToSession(Id userId, Id sessionId){
if(space=='avail'){ return true; }
else{ return false;}
}
From javascript:
var userId = '{!JSENCODE($UserInfo.Id)}';
var sessionId = '{!JSENCODE(controllerHasSessionId)}';
myControllerName.addUserToSession(userId, sessionId,function(result){
@mtetlow
mtetlow / gist:11219975
Created April 23, 2014 15:28
tooling api curl example
curl 'https://na3.salesforce.com/services/data/v29.0/tooling/query/?q=SELECT+isvisibleinselfservice%2C++activitydate%2C++isarchived%2C++type%2C++createdbyid%2C++bmg__dateopened__c%2C++priority%2C++description%2C++callobject%2C++isdeleted%2C++bmg__statusdescription__c%2C++recurrenceinterval%2C++systemmodstamp%2C++reminderdatetime%2C++bmg__statusupdateddate__c%2C++status%2C++bmg__type__c%2C++recurrenceenddateonly%2C++createddate%2C++ownerid%2C++recurrencetype%2C++isrecurrence%2C++whatid%2C++lastmodifiedbyid%2C++recurrencedayofmonth%2C++isclosed%2C++subject%2C++ce4sf20_001__aeguide_name__c%2C++recurrencedayofweekmask%2C++bmg__dateclicked__c%2C++bmg__messageurl__c%2C++lastmodifieddate%2C++id%2C++isreminderset%2C++bmg__isemailopened__c%2C++whoid%2C++recurrencestartdateonly%2C++calldurationinseconds%2C++accountid%2C++bmg__dateunsubscribed__c%2C++bmg__id__c%2C++bmg__clickdetails__c%2C++recurrencetimezonesidkey%2C++calltype%2C++bmg__isemailclicked__c%2C++recurrenceactivityid%2C++calldisposition%2C++bmg__isunsubscribe
function attachKanbanScrollModifier(){
$j('.kanban-column').on('scroll',function(){lazyScroll(this);});
}
var lazyScroll = _.debounce(function(column){columnScrolled(column)}, 150);
function columnScrolled(column){
var $column = $j(column);
var $columnChildren = $column.children('.task');
trigger basatitest on Project_Task__c (after insert, after update) {
for(Project_Task__c task: Trigger.new){
if((task.List__c == 'Finished') && (Trigger.IsInsert || (Trigger.Isupdate && (Trigger.OldMap.get(task.id).List__c <> 'Finished')))){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'[email protected]'};
mail.setToAddresses(toAddresses);
mail.setReplyTo('[email protected]');
mail.setSenderDisplayName('basati test');
mail.setSubject('basati test');
mail.setCharset('UTF-8');
trigger taskAfterUpdateAndInsert on TASKRAY__Project_Task__c (after insert, after update) {
for(TASKRAY__Project_Task__c task: Trigger.new){
if((task.TASKRAY__List__c == 'Finished') && (Trigger.IsInsert || (Trigger.Isupdate && (Trigger.OLdmap.get(task.id).TASKRAY__List__c <> 'Finished'))) ){
Datetime dt = Datetime.now();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'[email protected]'};
mail.setToAddresses(toAddresses);
mail.setReplyTo('[email protected]');
mail.setSenderDisplayName('basati test');
<apex:page docType="html-5.0" standardStylesheets="false" showHeader="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false">
<html>
<head>
<script type='text/javascript' src='/canvas/sdk/js/publisher.js'></script>
<script type='text/javascript'>
Sfdc.canvas.publisher.subscribe({
name: "publisher.showPanel",
onData:function(e) {
console.log('test1');
console.log(e);
//HTML
var customLabels=JSON.parse('{!JSENCODE(customLabelJSON)}');
//Apex
public static String customLabelJSON{ get; set; }
...
Map<String,String> labelValueMap = new Map<String,String>();
labelValueMap.put('blmd_SideBarHeader_FollowUpProcessing',System.Label.blmd_SideBarHeader_FollowUpProcessing);
customLabelJSON=JSON.serialize(labelValueMap);