Skip to content

Instantly share code, notes, and snippets.

@jkentjnr
jkentjnr / gist:d6391238652e96d79323
Last active August 29, 2015 14:16
Salesforce - DTOs to SObjects
// --------------
// DTO Base Class
global abstract class DtoBase {
global abstract String getSObjectName();
global abstract Map<String, Object> getSObjectMap();
global virtual SObject ToSObject() {
SObject obj = Schema.getGlobalDescribe().get(getSObjectName()).newSObject();
@jkentjnr
jkentjnr / gist:46b280737dd7d289955a
Created March 16, 2015 04:47
Get Salesforce Instance URL using Apex
// Get Current SFDC Instance URL
// For example: AP1 = 'https://ap1.salesforce.com
URL.getSalesforceBaseUrl().toExternalForm();
@jkentjnr
jkentjnr / gist:b775f63e6898dbd57f3f
Last active August 29, 2015 14:21
Blog - USING JQUERY TO REFERENCE AN INPUT IN VISUALFORCE
<apex:form id="form">
<apex:pageBlock id="blockContact" mode="edit">
<apex:pageBlockSection id="blockDetails" title="Details">
<apex:inputField id="inputContactName" value="{!Contact.Name}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
@jkentjnr
jkentjnr / gist:8f4217f9027c2427227f
Created May 27, 2015 00:00
Blog - AVOID “REGEX TOO COMPLICATED” ISSUES PROCESSING LARGE FILES
public with sharing class Utility_RowIterator implements Iterator<String>, Iterable<String>
{
private String m_Data;
private Integer m_index = 0;
private String m_rowDelimiter = '\n';
public Utility_RowIterator(String fileData)
{
m_Data = fileData;
}
@jkentjnr
jkentjnr / gist:64d87004b150f5a8c667
Last active January 25, 2019 03:44
Blog - Loading Data into Salesforce from Google Sheets
// -----------------------------------------
// CREATE CONTACTS FROM GOOGLE SHEET
// -----------------------------------------
// Name of the entry in the Documents entity.
String dataFile = 'DemoExport';
// -----------------------------------------
// Get the URL from Documents and retrieve from Google Sheets as TSV.
@jkentjnr
jkentjnr / Utility_Batch_Delete.java
Last active August 29, 2015 14:26
Blog - USEFUL APEX DELETE BATCH
global class Utility_Batch_Delete implements Database.Batchable<SObject>
{
private String q;
private String fq;
private String[] qs;
global Utility_Batch_Delete(String query)
{
q = query;
}
@jkentjnr
jkentjnr / GetTimesheetReportExportForLast30DaysAsCSV.java
Created August 7, 2015 03:23
Replicon - Execute Report via Web Service
// GET TIMESHEET REPORT METHOD - executes a predefined export report ---------------------------------
public String GetTimesheetReportExportForLast30DaysAsCSV(String[] projectUris) {
// Create the request body.
RepliconMessage.ExecuteReportRequest requestBody = new RepliconMessage.ExecuteReportRequest();
requestBody.reportUri = 'urn:replicon-tenant:jamesn-monroe:report:5107f417-8bff-444b-aed9-5d5aa9bbfb1c';
// Add the 30 day filter
requestBody.filterValues.add(
new RepliconMessage.ReportFilterValue('urn:replicon-tenant:jamesn-monroe:report-filter:354f94f3ac1d46518414c6c8affc3608;timesheetstartdaterangefilter', '16')
@jkentjnr
jkentjnr / gist:d8fdcc9b35e7b2811e24
Last active October 14, 2015 06:00
Salesforce Lightning: Navigate to List
<script>
sforce.one.navigateToList("00BB0000001L6FbMAK", "High Value Segment", "Contact");
</script>
{
"template": {
"key": "stkildamums"
},
"campaign": {
"key": "easter2016",
"title": "Donate",
"abstract": "We are a volunteer-run not-for-profit organisation based in St Kilda, Melbourne. <mark class=\"text-blue\">We rehome new and pre-loved baby goods and nursery equipment to families in need.<\/mark> We believe that by reusing and recycling much-loved babies\u2019 and children\u2019s gear, we not only share the joy of motherhood with each other, but we save the earth\u2019s precious resources too.",
"frequency": {
"onceOff": true,
@jkentjnr
jkentjnr / PageHeader.jsx
Created June 2, 2016 00:49
Quick Page Header component
import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
import { ButtonGroup, Icon } from 'react-lightning-design-system';
class PageHeader {
}
export class RecordView extends Component {
render() {
const { className, iconClassName, icon, iconCategory, subtitle, title, follow, cols, children, ...props } = this.props;