Skip to content

Instantly share code, notes, and snippets.

James Loghry dancinllama

Block or report user

Report or block dancinllama

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View launch2.json
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Apex Replay Debugger",
"type": "apex-replay",
"request": "launch",
"logFile": "${command:AskForLogFileName}",
View launch.json
{
"type": "browser-preview",
"request": "attach",
"name": "Browser Preview: Attach"
},
{
"type": "browser-preview",
"request": "launch",
"name": "Browser Preview: Launch",
"url": "http://localhost:3333"
View The Callback Class
//The enqueue deployment call (last call above), can optionally take a callback argument.
//I was running into an issue and needed a bit more debugging, so here's my callback for that.
//This call can be an inner class, by the way.
public class CustomMetadataCallback implements Metadata.DeployCallback {
public void handleResult(Metadata.DeployResult result, Metadata.DeployCallbackContext context) {
System.debug('status: ' + result.status);
if(!result.success){
System.debug('error1: ' + result.errorMessage);
System.debug('error2: ' + result.errorStatusCode);
System.debug('error3: ' + result.errorMessage);
View gist:99ebc1c9afeb5d1243920552f0d7ed08
import { LightningElement } from 'lwc';
import moment from '@salesforce/resourceUrl/moment';
import { loadScript } from 'lightning/platformResourceLoader';
export default class MomentStuffs extends LightningElement {
renderedCallback(){
Promise.all([
loadScript(this, moment + '/moment.js')
]).then(() => {
View FlowDebugger
public class InvocableDebugger{
@InvocableMethod
public static void debugMessage(List<String> messages){
for(String str : messages){
System.debug(str);
}
}
}
@dancinllama
dancinllama / Apex controller
Last active Nov 21, 2016
Component for displaying Contact Name(s)
View Apex controller
/**
* ContactsCtrl
* @description Apex and stuff..
* @author
* @date 11/21/2016
*/
public with sharing class ContactsCtrl {
@AuraEnabled
public static List<Contact> getContacts(){
View InvocableLogger - Apex class for logging messages in Flows
/**
* @description Simple invocable class (can be called via process or flow). For logging a message or messages to the debug logs.
* @author James Loghry
* @date 8/1/2016
*/
public class InvocableLogger {
@InvocableMethod
public static void log(List<String> messages){
if(messages != null){
for(String message : messages){
View gist:ac8809adcd03efa2d0ab
IF(
OR(
ISBLANK(Available_From__c)
,Available_From__c < CASE(
MOD(TODAY() - DATE( 1900, 1, 7 ), 7 ),
2, TODAY() + 2 + 4,
3, TODAY() + 2 + 4,
4, TODAY() + 2 + 4,
5, TODAY() + 2 + 4,
6, TODAY() + 1 + 4,
@dancinllama
dancinllama / 1. Lightning Design System Checkbox Lightning Component (cmp)
Last active Oct 7, 2015
The checkboxes in the Salesforce Lightning Design System are odd ducks. They require a DOM structure that the Lightning component or aura ui:inputCheckbox tag doesn't support natively, due to the "slds-checkbox--faux" span, etc. Furthermore, the SLDS checkbox uses Ids to control the value between the faux span and the input:checkbox. I'm not sur…
View 1. Lightning Design System Checkbox Lightning Component (cmp)
<!-- LDS markup for a checkbox (https://www.lightningdesignsystem.com/components/forms/) -->
<div class="slds-form-element margintop10">
<label class="slds-checkbox" for="requiredCheckbox">
<ui:inputCheckbox aura:Id="requiredCheckbox" value="{!v.selectedFormObject.Required_On_Form__c}" />
<span class="slds-checkbox--faux" />
<span class="slds-form-element__label marginleft10">Required on Form?</span>
</label>
</div>
@dancinllama
dancinllama / gist:2bfa01a863caa128cb91
Created Jan 16, 2015
SOQL parent relationship query
View gist:2bfa01a863caa128cb91
List<Account> parentAccounts = new List<Account>();
for(Contact contactWithAccountInfo : [Select Name,Account.Name,Account.AnnualRevenue From Contact]){
System.debug('Contact Account Id: ' + contactWithAccountInfo.Account.Id);
parentAccounts.add(contactWithAccountInfo.Account);
}
You can’t perform that action at this time.