Skip to content

Instantly share code, notes, and snippets.

View dancinllama's full-sized avatar

James Loghry dancinllama

View GitHub Profile
public class InvocableDebugger{
@InvocableMethod
public static void debugMessage(List<String> messages){
for(String str : messages){
System.debug(str);
}
}
}
@dancinllama
dancinllama / gist:99ebc1c9afeb5d1243920552f0d7ed08
Created December 19, 2018 03:51
Loading moment.js in a LWC
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(() => {
//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);
{
"type": "browser-preview",
"request": "attach",
"name": "Browser Preview: Attach"
},
{
"type": "browser-preview",
"request": "launch",
"name": "Browser Preview: Launch",
"url": "http://localhost:3333"
// 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}",