Skip to content

Instantly share code, notes, and snippets.

Account newAccount = new Account(
Name = 'Tobias Funke'
,AnnualRevenue = null
);
insert newAccount;
Account queriedAccount = [
SELECT
Id
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
function main(){
var boxes = $("[id^='display']");
$(boxes).each(function(){
$(this).prop('checked', true);
});
}
### DEBUG LOGGING LEVELS
Category Level Events
Database NONE
Workflow FINER WF_RULE_INVOCATION; WF_APPROVAL; WF_FIELD_UPDATE; WF_SPOOL_ACTION_BEGIN; WF_ACTION; WF_FORMULA; WF_RULE_EVAL_BEGIN; WF_RULE_EVAL_END; WF_RULE_EVAL_VALUE; WF_CRITERIA_BEGIN; WF_CRITERIA_END; WF_RULE_ENTRY_ORDER; WF_RULE_NOT_EVALUATED; WF_RULE_FILTER; WF_ESCALATION_RULE; WF_ESCALATION_ACTION; WF_TIME_TRIGGERS_BEGIN; WF_TIME_TRIGGER; WF_ACTIONS_END; WF_ENQUEUE_ACTIONS; WF_APPROVAL_SUBMIT; WF_APPROVAL_SUBMITTER; WF_APPROVAL_REMOVE; WF_NEXT_APPROVER; WF_EVAL_ENTRY_CRITERIA; WF_PROCESS_FOUND; WF_SOFT_REJECT; WF_HARD_REJECT; WF_PROCESS_NODE; WF_ASSIGN; WF_REASSIGN_RECORD; WF_RESPONSE_NOTIFY; WF_OUTBOUND_MSG; WF_ACTION_TASK; WF_EMAIL_ALERT; WF_EMAIL_SENT; SLA_PROCESS_CASE; SLA_NULL_START_DATE; SLA_EVAL_MILESTONE; SLA_END; WF_KNOWLEDGE_ACTION; WF_SEND_ACTION; WF_CHATTER_POST; WF_QUICK_CREATE; WF_FLOW_ACTION_BEGIN; WF_FLOW_ACTION_DETAIL; WF_FLOW_ACTION_END; WF_FLOW_ACTION_ERROR; WF_FLOW_ACTION_ERROR_DETAIL; WF_APEX_ACTI
$(window).ready(function() {
var parts = window.location.href.split('#');
parts.shift();
var querystring = parts.join('#');
var pairs = querystring.split('&');
var query = {}
var pairs = querystring.split('&');
for (var idx in pairs) {
var pair = pairs[idx];
var parts = pair.split('=');
@mickle00
mickle00 / bash_execute_anon.sh
Created October 28, 2014 22:48
Execute Salesforce Anonymous Code on repeat
#! /bin/bash
## requires force binary be in $PATH
## https://github.com/heroku/force
force login -i=test
## this will kick open a browser window to do OATH login
## there's a current quasi-bug with this using OATH and the browser not allowing the page to load, due to HTTPS => HTTP
## https://github.com/heroku/force/issues/89
/** UNCATCHABLE Exception **/
/**
List<AggregateResult> ar;
try{
ar = [SELECT COUNT(Id) totalSize, Country__c, Country__r.Name
FROM Account
WHERE Id IN (SELECT AccountId FROM AccountTeamMember WHERE UserId = '005C0000006DOS5')
GROUP BY Country__c ,Country__r.Name];
} catch (Exception e) {}
system.debug(ar.size());
string null1 = null;
string null2 = null;
string empty1 = '';
string empty2 = '';
system.debug(null1 + null2); //nullnull
system.debug(String.isNotEmpty(null1 + null2)); //true
system.debug(null1 + empty1); //null
system.debug(String.isNotEmpty(null1 + empty1)); //true
// This adds item to Batch Queue (limit 5, until FlexQueue)
// platform handles chunking up into batches of 200 records
// thus, getting new context of limits every batch
// Seems to be a Salesforce bug around FlexQueue in tests:
// See: https://gist.github.com/mickle00/70179703e885292793a0
// Also: https://twitter.com/mickle00/status/514511124125851648
Database.executeBatch(new VIPCSATSummaryUpdates());
@mickle00
mickle00 / FlexQueueExample.cls
Created September 23, 2014 20:24
Showing that the Apex Flex Queue does not appear to work in the context of Unit Tests.
global class FlexQueueExample implements Database.Batchable<sObject>{
global Iterable<sObject> start(Database.BatchableContext BC) {
return new List<sObject> {};
}
global void execute(Database.BatchableContext BC, List<sObject> scope){}
global void finish(Database.BatchableContext BC){}
// Works in Execute Anonymous for Count <= 100
string GROUP_NAME = 'LodgeOps Knowledge';
CollaborationGroup myGroup = [SELECT Id, Name FROM CollaborationGroup WHERE Name = :GROUP_NAME];
system.debug(myGroup);
List<User> pactUsers = [SELECT Id FROM User WHERE Profile.Name = 'Lodging Operations - PAC' AND isActive = true];
List<CollaborationGroupMember> groupMembers = new List<CollaborationGroupMember>();
for (User u : pactUsers){
groupMembers.add(
new CollaborationGroupMember(memberId = u.Id, CollaborationGroupId = myGroup.Id)