Skip to content

Instantly share code, notes, and snippets.

View SalesforceBobLightning's full-sized avatar
💭
Easy-peasy

Salesforce Bob Lightning SalesforceBobLightning

💭
Easy-peasy
View GitHub Profile
<template>
<div lwc:dom="manual" class="slds-hide"></div>
</template>
@SalesforceBobLightning
SalesforceBobLightning / GetSObjectFields.cls
Created May 14, 2019 21:46
Get Salesforce SObject fields using Apex
String sObjectName = 'FlowInterview'; // change this
Map<String, SObjectField> fields = Schema.getGlobalDescribe().get(sObjectName).getDescribe().fields.getMap();
for(String key : fields.keySet()) {
System.debug(fields.get(key));
}
@SalesforceBobLightning
SalesforceBobLightning / Request.cls
Created April 18, 2019 21:08
Salesforce Apex hashCode and equals implementation
public class Request {
@InvocableVariable(label = 'Template Name' required=true)
public String templateName;
@InvocableVariable(label = 'To Number' required=true)
public String toNumber;
@InvocableVariable(label = 'whoId' required=true)
public Id whoId;
@SalesforceBobLightning
SalesforceBobLightning / CreatePublicPDF.cls
Created April 17, 2019 10:51
Create PDF using Docomotion and host publicly
public class createPublicPDF {
private static String getMediaUrl(Id distributionId) {
ContentDistribution distribution = [SELECT DistributionPublicUrl FROM ContentDistribution WHERE Id = :distributionId LIMIT 1];
return distribution.DistributionPublicUrl;
}
public static Id createFaxPDF(Id recordId, Integer formId) {
ContentVersion content = new ContentVersion();
@SalesforceBobLightning
SalesforceBobLightning / ChainedQueueable.cls
Created April 12, 2019 18:14
Salesforce Apex Chained Queueable with String's rather than ID's
public abstract class ChainedQueueable implements Queueable, Database.AllowsCallouts {
private Set<String> records;
public ChainedQueueable(Set<String> records) {
this.records = records;
}
public abstract void processRecord(String record);
@SalesforceBobLightning
SalesforceBobLightning / NetworkUtils.cs
Created April 12, 2019 12:42
What is my Salesforce IP Address using Apex
public with sharing class NetworkUtils {
public static String WhatIsMyIPAddress() {
HttpRequest request = new HttpRequest();
// Don't forget to add http://icanhazip.com as a remote site.
request.setEndpoint('http://icanhazip.com/');
request.setMethod('GET');
@SalesforceBobLightning
SalesforceBobLightning / Thread.cls
Created April 5, 2019 06:44
Thread sleep helper method for Salesforce Apex
public class Thread {
public static void sleep(integer milliseconds)
{
Long timeDiff = 0;
DateTime firstTime = System.now();
do {
timeDiff = System.now().getTime() - firstTime.getTime();
}
while(timeDiff <= milliseconds);
@SalesforceBobLightning
SalesforceBobLightning / AbstractChainedQueueable.cls
Last active March 14, 2019 14:46
Salesforce Chained Queueable Abstract Apex Class
public abstract class AbstractChainedQueueable implements Queueable {
private Set<Id> recordIds;
public AbstractChainedQueueable(Set<Id> recordIds) {
this.recordIds = recordIds;
}
public abstract void processRecord(Id recordId);
@SalesforceBobLightning
SalesforceBobLightning / ChainedQueueable.cls
Last active March 14, 2019 00:09
Salesforce Chained Queueable Apex Class
public without sharing class ChainedQueueable implements Queueable {
private Set<Id> ids;
public ChainedQueueable(Set<Id> ids) {
this.ids = ids;
}
public void execute(QueueableContext context) {
@SalesforceBobLightning
SalesforceBobLightning / RingerPlugin-v2.js
Last active November 1, 2022 13:25
Twilio Flex Plug: Ringer + Call Recording
import { FlexPlugin } from 'flex-plugin';
//import React from 'react';
//import CustomTaskListComponent from './CustomTaskListComponent';
const PLUGIN_NAME = 'RingerPlugin';
export default class RingerPlugin extends FlexPlugin {
constructor() {
super(PLUGIN_NAME);
}