Skip to content

Instantly share code, notes, and snippets.

View mtetlow's full-sized avatar

Mike "Mikename" Tetlow mtetlow

  • AscendX
  • Denver CO
View GitHub Profile
@mtetlow
mtetlow / exampleJS.js
Created June 3, 2013 15:54
This is a first pass at creating a Salesforce.com APEX Remote Action wrapper for jQuery deferred objects. This will allow you to utilize the jQuery.deferred methods (http://api.jquery.com/category/deferred-object/), and avoid lengthy strings of callback methods.
function remoteActionDeferredWrap(remoteActionMethod, paramArr, escape){
//Create the deferred object
var deferredObj=$j.Deferred();
//Create the callback method, this will manipulate the deferred object to show when complete
var callback = function(result,status){
if(status.status==true){
deferredObj.resolve(result);
}
else{
deferredObj.reject('Error: '+status.message);
@mtetlow
mtetlow / ApexRESTExample.cls
Created April 10, 2013 14:41
The goal of this gist is to describe how to query an object within a SFDC Managed Package, with a user who is not licensed for access to the managed project. There are two components, an apex class containing a custom REST endpoint, and a VisualForce Page where we hit the SF AJAX Proxy enroute to the SF REST API.
@RestResource(urlMapping='/RestTest/*')
global with sharing class ApexRESTExample {
@HttpGet
global static List<NAMESPACE__ManagedPackageObject__c> getTasks() {
List<NAMESPACE__ManagedPackageObject__c> test = [SELECT Id, Name from NAMESPACE__ManagedPackageObject__c];
return test;
}
}
@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
@mtetlow
mtetlow / how_to_parse_this.java
Last active October 28, 2019 23:32
ConnectApi.SmartDataDiscovery API
ConnectApi.SmartDataDiscoveryPredictInputRecords input = new ConnectApi.SmartDataDiscoveryPredictInputRecords();
input.predictionDefinition = '0ORf0000000xxxxxxx';
input.records = new List<Id>{'a291Y000002Exxxxxxx'};
ConnectApi.SmartDataDiscoveryPrediction request =
ConnectApi.SmartDataDiscovery.predict(input);
// Everything up to here so far so good
System.debug('ConnectApi.SmartDataDiscoveryPrediction');
System.debug(JSON.serializePretty(request));
@mtetlow
mtetlow / OpportunityDependencies.app
Last active July 12, 2018 21:05
Using a TaskRay Lightning Component in Aloha
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="TASKRAY_LTNG:trProjectStatusBar"/>
</aura:application>
<apex:page standardController="TASKRAY__Project_Task__c" sidebar="false" showHeader="false">
<apex:slds />
<!-- Need to include chatter so the new button on the AttachedContentNotes related list works -->
<style>
.hidden {
display: none;
}
</style>
@mtetlow
mtetlow / gist:3e6869852280f3172e42ad766580b9e8
Created November 13, 2017 15:19
sfdx df17 migration notes
#TODO: Highlight line where cursor
Look at app:
https://sfdxdf17.na73.visual.force.com/apex/myApp?sfdc.tabName=01r1I000000c3dy
Examine app source
https://github.com/mtetlow/sfdxdf17-demo
###
<apex:page docType="html-5.0" standardStylesheets="false" showHeader="false" sidebar="false" standardController="Case" applyHtmlTag="false" applyBodyTag="false">
<html>
<body>
<iframe style="width: 100%; height: 300px; border: 0;"
src='/apex/TASKRAY__trChecklistAction?Id={!Case.REPLACE_WITH_YOUR_CUSTOM_FIELD_NAME}' />
</body>
</html>
@mtetlow
mtetlow / html markup
Created January 23, 2017 16:57
css progress bar indicator
<div class="progress-bar--container">
<div class="{!(v.projectCompletionPercentage == 0) ? 'progress-bar--bar progress-bar--zerowidthbar' : 'progress-bar--bar'}" style="{!'width: '+v.projectCompletionPercentage+'%'}">
<span class="progress-bar--pct-complete-label">{!v.projectCompletionPercentage+'%'}</span>
</div>
</div>
<aura:application >
<c:simpleRecordEdit />
</aura:application>