Skip to content

Instantly share code, notes, and snippets.

@and0ne808
and0ne808 / StatusPage.xml
Created November 26, 2017 02:45
StatusPage.cmp
<aura:component controller = "StatusService">
<aura:attribute name="statuses" type="Status__c[]" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:iteration items="{!v.statuses}" var="status">
<li>{!status.CreatedDate + ', ' + status.StatusText__c}</li>
</aura:iteration>
</aura:component>
@and0ne808
and0ne808 / StatusService.java
Created November 26, 2017 02:28
StatusService.apxc
public with sharing class StatusService {
@AuraEnabled
public static List<Status__c> getStatuses() {
return [SELECT Name, StatusText__c, CreatedDate
FROM Status__c ORDER BY CreatedDate DESC LIMIT 10]; }
}
@and0ne808
and0ne808 / CustomApproval.html
Created November 17, 2017 05:56
Opportunity Approval Controller Extension and Visualforce Page
<apex:page standardController="Opportunity" extensions="CustomApprovalController">
<h1>
Welcome to the Custom Opportunity Approval Page
</h1>
<p>
By Andrew Day
</p>
<b>OPPORTUNITY DETAILS</b> <br/>
@and0ne808
and0ne808 / UpdateBudget.java
Created November 15, 2017 02:01
Update Budget apxt Apex Trigger
trigger UpdateBudget on Transaction__c (after insert) {
System.debug('trigger triggered');
for(Transaction__c t : Trigger.New)
{
//grab the related employee
User theUser = [SELECT Id, Name FROM User WHERE Id = :(t.Employee_Id__c)];
//grab the user's budget
@and0ne808
and0ne808 / ShoppingCartPage.html
Created November 15, 2017 01:59
Shopping Cart Page Visualforce file
<apex:page controller="ShoppingCartController">
<p>
Your User Id: {!userId}
</p>
<p>
Your Username: {!userName}
</p>
<p>
@and0ne808
and0ne808 / ShoppingCartController.java
Created November 15, 2017 01:58
Apex Shopping Cart Controller
public class ShoppingCartController {
public List<Material__c> materials { get; set; }
//Current User Details
public Id userId { get; set; }
public String userName { get; set; }
public Decimal allocatedBudget { get; set; }
public Decimal remainingBudget { get; set; }
public Decimal budgetSpent { get; set; }
@and0ne808
and0ne808 / SmartCreateOpportunity.html
Created November 13, 2017 15:21
Smart Create Opportunity Visualforce Page
<apex:page controller="SmartCreateOpportunityController">
<style>
#power-title {
font-size:20px;
}
</style>
<img src="/resource/1510245559000/SmartSearchPic"/>
@and0ne808
and0ne808 / SmartCreateOpportunityController.java
Created November 13, 2017 15:18
Apex Controller for Opportunity Creator with Live Smart Search
public class SmartCreateOpportunityController
{
public List<Account> accounts { get; set; }
public List<Asset> assets { get; set; }
public String accountSearchKeyword { get; set; }
public String selectedAccountName { get; set; }
public String assetSearchKeyword { get; set; }
public Id myId { get; set; }
public Account selectedAccount { get; set; }
public Map<Id,Asset> selectedAssetMap { get; set; }
@and0ne808
and0ne808 / MailUtil.java
Created November 12, 2017 20:14
Apex class - simple guide to send email notifications in Apex for salesforce apps.
public class MailUtil {
public void SendMailTest() {
//1. Reserve Email Capacity so you don't go over limits
Messaging.reserveSingleEmailCapacity(5);
//2. Create new mail object
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
@and0ne808
and0ne808 / MailUtil.apxc
Created November 12, 2017 20:13
Simple Guide to send email alerts in Apex for salesforce apps.
public class MailUtil {
public void SendMailTest() {
//1. Reserve Email Capacity so you don't go over limits
Messaging.reserveSingleEmailCapacity(5);
//2. Create new mail object
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();