Skip to content

Instantly share code, notes, and snippets.

View dangt85's full-sized avatar

Daniel Gonzalez dangt85

View GitHub Profile
@dangt85
dangt85 / b2b-scratch-def.json
Last active November 11, 2024 16:34
Salesforce B2B & D2C Commerce scratch org definition file
{
"orgName": "B2B Company",
"edition": "Developer",
"features": [
"Communities",
"B2BCommerce",
"OrderManagement",
"OrderSaveLogicEnabled",
"SalesforcePaymentsFeature",
"DebugApex",
@dangt85
dangt85 / DF15-Bulk-JSForce
Created June 28, 2016 02:04
JSForce Bulk Load demo using JS promises
<apex:page standardcontroller="Lead" docType="html-5.0" title="Bulk Lead Processor">
<apex:includeScript value="{!URLFOR($Resource.JSForce,'jsforce.js')}" />
<style>
/* This is for the full screen DIV */
.popupBackground {
/* Background color */
background-color: black;
opacity: 0.20;
filter: alpha(opacity=20);
@dangt85
dangt85 / PhotoSyncHandler
Created June 24, 2016 13:05
PhotoSyncHandler helper class
global class PhotoSyncHandler {
/*
//Sync the user's picture
String pictureUrl = null;
if (data.provider == 'Facebook') {
pictureUrl = 'https://graph.facebook.com/' + data.identifier + '/picture?type=large';
} else if (data.provider == 'LinkedIn'){
pictureUrl = data.attributeMap.get('picture-url');
@dangt85
dangt85 / SocialRegHandler
Last active June 24, 2016 13:07
Salesforce Custom Auth.RegistrationHandler for Social Sign-On
global class SocialRegHandler implements Auth.RegistrationHandler{
static final string social_account = 'Social Sign-On';
static final string community_profile = 'Customer Community User';
static final string standard_profile = 'Standard User';
void prepareUserData(Auth.UserData data, User u)
{
String name, firstName, lastName, username, alias, email;
@dangt85
dangt85 / gist:59433b49c73fe32584d3
Last active September 8, 2015 19:20 — forked from tstachl/gist:2760221
Salesforce open Simple Dialog in custom button/link or on a visualforce page
// if you want to use it inside a visualforce page create a function around it
//function showFollowUp() {
// if you want to use it in a button make sure you require jQuery
// {!REQUIRESCRIPT("https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")} // UNCOMMENT IF IN A BUTTON
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
// get the dialog with your dialog name
var d = sfdcPage.dialogs['MyCoolDialog'], close;
if (!d) {
@dangt85
dangt85 / ApexClass-CustomListController.template
Created June 8, 2015 13:52
Custom List Controller class
/**
@Author <Author Name>
@name @@NAME@@
@CreateDate <dd/mm/yyyy>
@Description <purpose of the class>
@Version <1.0>
@reference <Referenced program names>
*/
public with sharing class @@NAME@@ {
/**
@Author <Author Name>
@name @@NAME@@
@CreateDate <dd/mm/yyyy>
@Description <purpose of the class>
@Version <1.0>
@reference <Referenced program names>
*/
public with sharing class @@NAME@@ {
@dangt85
dangt85 / ApexClass-StandardControllerExtension.template
Last active August 29, 2015 14:22
Basic Controller extension Apex Class
/**
@Author <Author Name>
@name @@NAME@@
@CreateDate <dd/mm/yyyy>
@Description <purpose of the class>
@Version <1.0>
@reference <Referenced program names>
*/
public with sharing class @@NAME@@ {
@dangt85
dangt85 / Visualforce-StandardSetControllerWithExtensions.template
Last active August 29, 2015 14:22
Visualforce page Standard Set Controller using Record Set Variable, standard basic pagination buttons and extensions
<apex:page standardController="SObject" recordSetVar="sObjects" tabStyle="Custom__tab/SObject" extensions="@@NAME@@"
id="__Page" title="@@NAME@@">
<!--
Describe what this page is for.
-->
<apex:form>
<apex:pageMessages />
<apex:pageBlock title="Feature" mode="edit" id="thePageBlock">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save" />
@dangt85
dangt85 / Visualforce-StandardController.template
Created June 8, 2015 13:16
Basic Visualforce page with standard controller
<apex:page standardController="SObject" tabStyle="Custom__tab/SObject" id="__Page" title="@@NAME@@">
<!--
Describe what this page is for.
-->
<apex:form>
<apex:pageMessages />
<apex:pageBlock title="Feature" mode="edit" id="thePageBlock">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save" />
</apex:pageBlockButtons>