Skip to content

Instantly share code, notes, and snippets.

View jaspreetsidhu's full-sized avatar
🎯
Focusing

Jaspreet jaspreetsidhu

🎯
Focusing
View GitHub Profile
IF(
(NOT(ISBLANK(Population__c)) && ((ISPICKVAL(Type__c, "Borough")) || (ISPICKVAL(Type__c, "County")))),
IF((Population__c / 2) >= 500000, "P10",
IF((Population__c / 2) >= 250000, "P09",
IF((Population__c / 2) >= 125000, "P08",
IF((Population__c / 2) >= 80000, "P07",
IF((Population__c / 2) >= 40000, "P06",
IF((Population__c / 2) >= 20000, "P05",
IF((Population__c / 2) >= 100000, "P04",
IF((Population__c / 2) >= 5000, "P03",
public class RandomContactFactory {
public static List<Contact> generateRandomContacts(Integer numOfContacts, String lName) {
List<Contact> cList = new List<Contact>();
for(Integer i=0; i<numOfContacts; i++) {
Contact c = new Contact(Firstname = 'Test' + i, Lastname = lName);
conList.add(c);
}
return cList;
}
@isTest
public class TestRestrictContactByName {
@isTest static void testContactTrigger() {
Test.StartTest();
Contact c = new Contact(LastName = 'INVALIDNAME');
Database.SaveResult result = Database.insert(c, false);
System.assert(!result.isSuccess());
System.assert(result.getErrors().size() > 0);
Test.StopTest();
@isTest
public class TestRestrictContactByName{
@isTest static void testRestrictContactByName () {
Contact c = new Contact(LastName='INVALIDNAME');
try{
insert c;
}
catch(DMLException e){
System.assert(e.getMessage().contains('The Last Name "'+c.LastName+'" is not allowed for DML'));
}
@isTest
private class TestVerifyDate{
@isTest static void testCheckDates(){
Date d2 = system.today();
Date d1 = d2.addDays(10);
Date dt = VerifyDate.CheckDates(d1, d2);
Date testDate = Date.newInstance(2019, 9, 30);
System.assertEquals(dt, testDate);
}
Delivered-To: jaspreet.sidhu+flashparking@ebq.com
Received: by 2002:a9d:6d14:0:0:0:0:0 with SMTP id o20csp1340713otp;
Wed, 22 May 2019 14:57:44 -0700 (PDT)
X-Google-Smtp-Source: APXvYqyKN24GrdXveyK4cvnI2Outrfjfvt4rQyXNutyvVYbpdhQlZk467GIwzK3RAscKgibKGbXk
X-Received: by 2002:a05:6830:1104:: with SMTP id w4mr13771522otq.165.1558562264057;
Wed, 22 May 2019 14:57:44 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1558562264; cv=none;
d=google.com; s=arc-20160816;
b=Jz/VYs39o3NTMN3FPeguJqktAN1NqfWiqiF0+Tar+Yg/q5aaKxQh7YB04QOfm/OjrG
aD1CDk6LyDtnT7Zr+GHR3i5D6iZUFh9i3Si0WvfsBWC6QB1SHrrEAj9gddBWJVAeYqYN
@jaspreetsidhu
jaspreetsidhu / Pardot Javascript
Created May 22, 2019 12:56
Pardot Javascript UTM
<script type="text/javascript">
// Parse the URL
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// Give the URL parameters variable names
var source = getParameterByName('utm_source');
{"caused_by":"macos","macos_version":"Mac OS X 10.14.4 (18E226)","os_version":"Bridge OS 3.4 (16P4507)","macos_system_state":"running","incident_id":"594BD800-C79C-4058-8BC0-7FACA4EB8922","timestamp":"2019-05-06 18:53:05.66 +0000","bug_type":"210"}
{
"build" : "Bridge OS 3.4 (16P4507)",
"product" : "iBridge2,7",
"kernel" : "Darwin Kernel Version 18.5.0: Mon Mar 11 20:29:36 PDT 2019; root:xnu-4903.251.3~1\/RELEASE_ARM64_T8010",
"incident" : "594BD800-C79C-4058-8BC0-7FACA4EB8922",
"crashReporterKey" : "c0dec0dec0dec0dec0dec0dec0dec0dec0de0001",
"date" : "2019-05-06 18:53:05.40 +0000",
"panicString" : "panic(cpu 1 caller 0xfffffff009011c60): macOS watchdog detected\nDebugger message: panic\nMemory ID: 0x6\nOS version: 16P4507\nmacOS version: 18E226\nKernel version: Darwin Kernel Version 18.5.0: Mon Mar 11 20:29:36 PDT 2019; root:xnu-4903.251.3~1\/RELEASE_ARM64_T8010\nKernelCache UUID: C58ACD7BFD5DECFA33BBC378E7D07A6E\nKernel UUID: A6E867AA-A072-3068-B269-6E87AA80ACAC\niBoot version: iBoot-4513.250.
@jaspreetsidhu
jaspreetsidhu / Javascript Button
Created May 2, 2019 13:08
Old Javascript button
{ !REQUIRESCRIPT("/soap/ajax/31.0/connection.js") }
var myquery = "SELECT Id, Name, Sent_to_Epicor__c, Contact_ID_Lookup__c FROM Opportunity WHERE Id = '{!Opportunity.Id}' limit 1";
result = sforce.connection.query(myquery);
records = result.getArray("records");
var myOpp = records[0];
var updateOpp = new Array();