Skip to content

Instantly share code, notes, and snippets.

//PUBLISHER
var j$ = jQuery.noConflict();
Sfdc.canvas(function(){
alert("Page loaded, libraries ready");
console.log("Page loaded, libraries ready");
//set up message publisher event handler
j$("#btnSend").click(function(){
var message = j$("#msgbox").val();
@rupton
rupton / gist:5622816
Created May 21, 2013 20:09
This is the main AccountList Page shown in DC Elevate to export Accounts to CSV File
<apex:page standardController="Account" recordSetVar="accounts">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accounts}" var="account">
<apex:column >
<apex:facet name="Header">Account Name:</apex:facet>
<apex:outputField value="{!account.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="Header">Annual Revenue:</apex:facet>
@rupton
rupton / gist:5622829
Created May 21, 2013 20:10
This is the page that outputs Accounts as a CSV file
<apex:page standardController="Account" recordSetVar="accounts" contentType="text/csv#accountlist.csv" sidebar="false" showHeader="false">
Account Name, Annual Revenue
<apex:repeat value="{!accounts}" var="account">
{!account.Name},{!account.annualrevenue}
</apex:repeat>
</apex:page>
@rupton
rupton / gist:5638088
Created May 23, 2013 18:03
Apex Code to compare SObjects against other types in support of force.com blog entry
public class ObjectHelper{
public static boolean compareTypes(SObject compare, String checkType){
try{
Schema.SObjectType targetType = Schema.getGlobalDescribe().get(checkType);
if(targetType == null){
return false;
}else if( compare.getSObjectType() == targetType){
return true;
}
}catch(Exception e){
@rupton
rupton / gist:5664434
Last active December 17, 2015 19:59
Object Type Comparison Using Ajax with Test
public class ObjectHelper{
public static boolean compare(SObject compare, String checkType){
try{
Schema.SObjectType targetType = Schema.getGlobalDescribe().get(checkType);
if(targetType == null){
return false;
}else if( compare.getSObjectType() == targetType){
return true;
}else{
return false;
@rupton
rupton / gist:6872687
Created October 7, 2013 18:28
Account List CSV
<apex:page standardController="Account" cache="true" recordSetVar="accounts" showheader="false" sidebar="false" contentType="text/csv#annualrevenue.csv">
<apex:repeat value="{!accounts}" var="account">
{!account.Name},{!account.AnnualRevenue},
</apex:repeat>
</apex:page>
@rupton
rupton / AccountList PDF
Created October 7, 2013 18:30
Account List PDF
<apex:page standardController="Account" recordSetVar="accounts" renderAs="PDF">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accounts}" var="account">
<apex:column >
<apex:facet name="Header">Account Name:</apex:facet>
<apex:inputField value="{!account.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="Header">Annual Revenue:</apex:facet>
@rupton
rupton / AccountListDynamicVF
Created October 7, 2013 18:31
AccountList Dynamic VF
<apex:page standardController="Account" recordSetVar="accounts">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accounts}" var="account">
<apex:column >
<apex:facet name="Header">Account Name:</apex:facet>
<apex:inputField value="{!account.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="Header">Annual Revenue:</apex:facet>

This gist contains multiple files. Each file contains a specific type of Apex or Visualforce comment header.

When code is no longer used, but can not be deleted from your org, add the @deprecated annotation to the File or Method Header.

This gist contains multiple files. Each file contains a specific type of Apex or Visualforce comment header.

When code is no longer used, but can not be deleted from your org, add the @deprecated annotation to the File or Method Header.