Skip to content

Instantly share code, notes, and snippets.

@erev1
erev1 / child.html
Last active October 8, 2020 17:37
Passing Data from Parent to Child LWC
<template>
<div class="slds-m-horizontal_xx-small slds-m-bottom_x-small">
<lightning-icon icon-name={iconname} size="x-small"></lightning-icon>
<span class="slds-p-left_small">{label}</span>
</div>
</template>
let pivotFunction = function(list, startIndex, endIndex) {
let pivotIndex = Math.floor((startIndex + endIndex) / 2)
let pivot = list[pivotIndex]
console.log("pivotindex", pivotIndex)
let leftPointer = startIndex
let rightPointer = endIndex
@erev1
erev1 / OverDueFollowUps.js-meta.xml
Created September 1, 2020 03:41
Over Due Follow Ups Config File
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>49.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
@erev1
erev1 / followUpManager.cls
Created September 1, 2020 03:33
Follw Up Manager Class
public with sharing class FollowUpManager {
@AuraEnabled (cacheable=true)
public static List<Clinic_Tracker__c> getFollowUps(){
Date today = Date.today();
Id userId = UserInfo.getUserId();
List<Clinic_Tracker__c> cts = [SELECT Name, Next_Follow_Up_Date__c, Notes__c FROM
Clinic_Tracker__c WHERE Next_Follow_Up_Date__c <= :today AND OwnerId = :userId];
return cts;
@erev1
erev1 / OverDueFollowUps.js
Last active September 1, 2020 03:17
Over Due Follow Ups JS
import { LightningElement, wire } from 'lwc';
import getAllFollowUps from "@salesforce/apex/FollowUpManager.getFollowUps";
export default class OverDueFollowUps extends LightningElement {
@wire(getAllFollowUps) followUps;
get responseReceived(){
return this.followUps;
@erev1
erev1 / OverDueFollowUps.html
Created September 1, 2020 01:43
Over Due Follows Ups HTML
<template>
<lightning-card>
<div slot="title" class="slds-text-title_bold">
Today's Clinic Follow Ups
</div>
<ul>
<template if:true={responseReceived}>
<template for:each={followUps.data} for:item="followUp">
<li key={followUp.id}>
<div class="slds-p-around_medium">
@erev1
erev1 / contactFormExample.page
Last active August 17, 2020 00:36
Visualforce + Bootstrap
<apex:page standardController="Contact" docType="html-5.0" sidebar="false" standardStyleSheets="false">
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z"
crossorigin="anonymous" />
</head>
<div class="container">
<apex:pageBlock>
<div class="jumbotron" style="background-color: #2c113e">
@isTest
public class createCaseAndAttachVMTest {
@isTest static void testVMInsert(){
//create and insert a contact with a phone number
Contact c = new Contact(FirstName='Eneida',
LastName='Revueltas',
MobilePhone = '650-555-5555');
insert c;
trigger ContentVersionTrigger on ContentVersion (before insert, after insert, after update, before update, before delete, after delete) {
switch on Trigger.operationType {
when BEFORE_INSERT {
System.debug('Before Insert');
}
when AFTER_INSERT {
System.debug('After Insert');
ContentVersionHandler.createCaseAndAttachVM(Trigger.new);
}
public without sharing class ContentVersionHandler {
public static String getPhoneNumberFromTitle(String title){
String p = title.substring(11,21);
String editedNumber = p.substring(0,3) + '-' +
p.substring(3,6) + '-' +
p.substring(6,10);
return editedNumber;
}