Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View afawcett's full-sized avatar

Andrew Fawcett afawcett

View GitHub Profile
@afawcett
afawcett / AddPicklistItemAction.cls
Last active January 4, 2023 11:47
Prototype Invocable Method wrapping the Salesforce Metadata API to allow management of Picklist Items via Process Builder and Visual Flow
/**
* Copyright (c) 2015, FinancialForce.com, inc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@afawcett
afawcett / CustomMetadataService.cls
Last active March 30, 2021 17:10
Custom Metadata POC for DLRS
/**
* Copyright (c) 2013, Andrew Fawcett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@afawcett
afawcett / EV3DirectCommand.java
Created October 4, 2015 18:19
Lego EV3 MachineCloud Java Code
package com.andyinthecloud.legoev3force.ev3kernal;
import lejos.hardware.Button;
import lejos.hardware.motor.Motor;
import lejos.hardware.port.SensorPort;
import lejos.hardware.sensor.EV3TouchSensor;
import lejos.robotics.SampleProvider;
import lejos.robotics.filter.AbstractFilter;
/**
@afawcett
afawcett / AddressFinder.cmp
Last active November 25, 2022 08:58
Salesforce London World Tour 2016: Lightning Out: Components on Any Platform
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"
controller="AddressFinderController" access="global">
<aura:attribute name="accounts" type="Account[]"/>
<aura:attribute name="contacts" type="Contact[]"/>
<aura:registerEvent name="AddressInfo" type="c:AddressInfo"/>
<div class="slds-form--stacked">
<div class="slds-form-element">
<label class="slds-form-element__label" for="inputSample2">Account Search</label>
PermissionSet permissionSet = new PermissionSet();
permissionSet.Name='ApexTest';
permissionSet.label='Apex Test';
insert permissionSet;
ObjectPermissions objectPermission = new ObjectPermissions();
objectPermission.ParentId = permissionSet.Id;
objectPermission.SObjectType = Book_Order__c.SObjectType.getDescribe().getName();
objectPermission.PermissionsEdit = true;
objectPermission.PermissionsRead = true;
objectPermission.PermissionsDelete = true;
@afawcett
afawcett / build.xml
Created July 16, 2016 11:15
Cloud9 /src Directory Fix
<project>
<target name="cloud9.github.init">
</target>
<target name="sync.from.cloud9">
<sync todir="src/classes" verbose="true">
<fileset dir="${basedir}/classes">
<exclude name="**/.c9/**"/>
</fileset>
</sync>
@afawcett
afawcett / MyReportNotificationFlow-1.flow
Created September 26, 2016 09:25
Definition of the TaskReminder Flow
<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<actionCalls>
<name>TaskReminder</name>
<label>TaskReminder</label>
<locationX>21</locationX>
<locationY>32</locationY>
<actionName>NewTask</actionName>
<actionType>quickAction</actionType>
<inputParameters>
public with sharing class EinsteinAction {
public class Prediction {
@InvocableVariable
public String label;
@InvocableVariable
public Double probability;
}
@InvocableMethod(label='Classify the given files' description='Calls the Einsten API to classify the given ContentVersion files.')
/**
*
CustomMetadata.Operations
.callback(
// Platform event for deploy status
MetadataDeployment__e.getSObjectType(),
MetadataDeployment__e.DeploymentId__c,
MetadataDeployment__e.Result__c)
.enqueueUpsertRecords(
// Metadata record type
@afawcett
afawcett / WidgetRecordEdit.cmp
Created May 30, 2017 02:15
Lightning Component for Lightning Edit Action Override
<aura:component implements="lightning:actionOverride,force:hasRecordId,force:hasSObjectName">
<aura:attribute name="record" type="Object" />
<aura:attribute name="componentRecord" type="Object" />
<aura:attribute name="recordError" type="String" />
<force:recordData
aura:id="recordLoader"
recordId="{!v.recordId}"
layoutType="FULL"