This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest class sendAnEmailSeleTest { | |
@isTest static void test() { | |
// Prepare your record data, possibly including parent/related records | |
Selement__c testSelement = new Selement__c( | |
// Populate fields here | |
Name = 'Test' // field = value, field = value, ... | |
); | |
insert testSelement; | |
// Build your request | |
sendAnEmailSele.Request[] requests = new sendAnEmailSele.Request[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MonitorAsyncUsage implements Schedulable { | |
public class ResourceInfo { | |
public Integer Max; | |
public Integer Remaining; | |
} | |
public class LimitsAPI { | |
public ResourceInfo DailyAsyncApexExecutions; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] objects = new String[0]; | |
Set<String> exceptions = new Set<String> { 'caseexternaldocument' }; | |
for(sObjectType t: Schema.getGlobalDescribe().values()) { | |
DescribeSObjectResult r = t.getDescribe(); | |
if(r.isSearchable() && !exceptions.contains((''+t).toLowerCase())) { | |
objects.add(t+'('+string.join(r.fields.getMap().keySet(),',')+')'); | |
} | |
} | |
String searchTerm = 'find {demo} in all fields returning '+string.join(objects,','); | |
System.debug(searchTerm.length()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WARNING: uses lots of CPU time, set all log levels to NONE, Apex to ERROR. | |
String[] charset = new String[0]; | |
for(Integer i = 48; i < 58; i++) { | |
charset.add(String.fromCharArray(new Integer[]{i})); | |
} | |
for(Integer i = 65; i < 91; i++) { | |
charset.add(String.fromCharArray(new Integer[]{i})); | |
} | |
for(Integer i = 97; i < 123; i++) { | |
charset.add(String.fromCharArray(new Integer[]{i})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StripInaccessibleAction { | |
public class Input { | |
@InvocableVariable( | |
description='The record to clean up' | |
label='Record' | |
required=true | |
) | |
public sObject record; | |
@InvocableVariable( | |
description='The access type to use' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Asking for extra CPU time and heap for those really "heavy" orgs | |
@isTest class GetExtraLimitsForYourUnitTest implements Queueable { | |
@testSetup static void testSetup() { | |
Test.startTest(); // TIP: this avoids governor limits for your @isTest methods | |
System.enqueueJob(new GetExtraLimitsForYourUnitTest()); // We'll get async limits! | |
// P.S. Did you know that the end of a unit test method triggers async code, | |
// just as if you called Test.stopTest()? | |
} | |
public void execute(QueueableContext context) { | |
// I now have 60000ms to do my setup, instead of just 10000ms. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CsvParser { | |
String csv; | |
Integer rowCount; | |
Integer cellCount; | |
final static String END_LINE = '\r'; | |
final static String END_CELL = ','; | |
final static String ESCAPE_CHAR = '"'; | |
final static String SPACE = ' '; | |
public CsvParser(String csvString) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://salesforce.stackexchange.com/a/376822/2984 | |
// Efficiently checking if any fields from a list of fields have changed | |
public class DataUtils { | |
public class Change { | |
public String[] changedFields = new String[0]; | |
public sObject record1, record2; | |
Change(String[] changedFields, sObject record1, sObject record2) { | |
this.changedFields = changedFields; | |
this.record1 = record1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Logger { | |
static Pattern thePattern = Pattern.compile( | |
'(?i)^(?:class\\.)?([^.]+)\\.?([^\\.\\:]+)?[\\.\\:]?([^\\.\\:]*): line (\\d+), column (\\d+)$' | |
); | |
static Log__c[] logs = new Log__c[0]; | |
static LoggingLevel controlLevel = LoggingLevel.DEBUG; | |
public static void addLog(String message) { | |
addLog(new DmlException(), controlLevel, message, null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:application > | |
<aura:attribute name="show" type="Boolean" default="false" /> | |
<aura:if isTrue="{!v.show}"> | |
<c:q369501c /> | |
</aura:if> | |
</aura:application> |
NewerOlder