Skip to content

Instantly share code, notes, and snippets.

View forcementor's full-sized avatar

Don Robins forcementor

View GitHub Profile
public with sharing class MondoControllerExt {
private ID bookingId {get;set;}
private String pdfName {get;set;}
private Booking__c booking {get;set;}
private Booking__c bookingRef {get;set;}
private final ApexPages.StandardController controller;
public string pageMessage {get;set;}
public with sharing class AttendeeService {
/*
* Registers Attendees to a list of Sessions
* Params:
* Session Id lists mapped to Attendee id's
*/
public static void registerAttendeeForSession(Map<Id, Id[]> sessionsByAttendee) {
// getting the data from the database
public class MondoSample
{
@future
public static void doCalc(List<Id> opps)
{
String yr = Date.today().addYears(1).year().format().replaceAll(',', '');
system.debug('year: ' + yr);
FiscalYearSettings fys = [select StartDate from FiscalYearSettings where name = :yr limit 1];
Date Q1Start = fys.StartDate;
//====================================================================
// Name: MicroserviceManagerDemo
// Type: Class
// Purpose: Demo routines for demoing the MicroserveManager
// Created by: Don Robins
// Created on: Dec 1, 2017
//====================================================================
// Setup Steps: (NOTE- Run this in Classic, NOT in Lightning Experience as Attachments are deprecated.)
// 1) Clone the PFDParser Repo and deploy to a Heroku instance from:
// https://github.com/forcementor/pdf-convert.git
//====================================================================
// Name: MicroserviceManager
// Type: Class
// Purpose: Routines for managing setup and calls to a microservice
// Created by: Don Robins
// Created on: Dec 1, 2017
//====================================================================
public class MicroserviceManager {
//Endpoint as Named Credential for the PDF Parser service.
@forcementor
forcementor / flawed code
Created October 22, 2012 00:48
Developing Mobile…Force.com and Sencha-Part 3, Step 3: Repair the error listener code
//THIS IS THE FLAWED CODE!
//Listen for exceptions observed by the proxy so we can report them and clean up.
Ext.getStore('Leads').getProxy().addListener('exception', function (proxy, response, operation, options) {
// only certain kinds of errors seem to have useful information returned from the server
if (response.data) {
if (response.data.errorMessage) {
Ext.Msg.alert('Error', response.data.errorMessage);
} else {
Ext.Msg.alert('Error', operation.action + ' failed: ' + response.data.message);
}
@forcementor
forcementor / PocketCRMController.Query()
Created October 22, 2012 00:43
Developing Mobile…Force.com and Sencha-Part 3, Step 2: Refactored Query() on Apex controller
@RemoteAction
public static Response Query(QueryRequest qr) {
Response resp = new Response();
//Enforce a limit on the number of rows requested.
final integer QUERY_LIMIT = 500;
if (qr.start >= QUERY_LIMIT) {
resp.success = false;
resp.errorMessage = 'Maximum number of records (' + String.valueOf(QUERY_LIMIT) + ') exceeded!';
@forcementor
forcementor / PocketCRMController.getAllLeads()
Created October 22, 2012 00:42
Developing Mobile…Force.com and Sencha-Part 3, Step 2: Refactored getAllLeads() on Apex controller
private static void getAllLeads(QueryRequest qr, Response resp) {
//Page size is set in the Sencha store as recordCount.
Integer pageSize = qr.recordCount;
//Page number will be calculated.
Integer pageNumber = 0;
//Start is the record number indicating the start of the page.
if (qr.start > 0) {
@forcementor
forcementor / PocketCRMController.getAllLeads()
Created October 22, 2012 00:36
Developing Mobile…Force.com and Sencha-Part 3, Step 2: Lookback at getAllLeads() on Apex controller
private static List < Lead > getAllLeads() {
return [SELECT
FirstName, LastName, Company, Title, Phone, MobilePhone, Email, Status
FROM Lead LIMIT 50];
}
@forcementor
forcementor / PocketCRMController.Query()
Created October 22, 2012 00:33
Developing Mobile…Force.com and Sencha-Part 3, Step 2: Lookback at Query() on Apex controller
@RemoteAction
public static Response Query(QueryRequest qr) {
Response resp = new Response();
List < Lead > LeadList;
filterString = qr.searchFilter;
try {
//Fetch all Leads for the user
LeadList = getAllLeads();
} catch (Exception e) {