Skip to content

Instantly share code, notes, and snippets.

View RatanPaul's full-sized avatar
💭
I may be slow to respond.

Ratan Paul (http://ratanpaul.github.io/) RatanPaul

💭
I may be slow to respond.
View GitHub Profile
String username='';
String pwd='';
HttpRequest request = new HttpRequest();
request.setEndpoint('https://www.salesforce.com/services/Soap/u/32.0');
request.setMethod('POST');
request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
request.setHeader('SOAPAction', '""');
request.setBody('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><login xmlns="urn:partner.soap.sforce.com"><username>' + userName+ '</username><password>' + pwd+ '</password></login></Body></Envelope>');
Dom.XmlNode resultElmt = (new Http()).send(request).getBodyDocument().getRootElement()
@RatanPaul
RatanPaul / react-table-component.js
Created April 4, 2016 11:07 — forked from ChaseWest/react-table-component.js
React Table Component for creating a very basic html table
var Table = React.createClass({
render: function render() {
var _self = this;
var thead = React.DOM.thead({},
React.DOM.tr({},
this.props.cols.map(function (col) {
return React.DOM.th({}, col);
})));
<apex:page standardStylesheets="false" showHeader="false" applyHtmlTag="false" docType="html-5.0">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<meta charset="UTF-8" />
<title>Hello React</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<apex:includeScript value="//cdn.rawgit.com/mattwelch/makeDeferredProvider/master/makeDeferredProvider.min.js"/>
<apex:stylesheet value="//cdn.rawgit.com/mailtoharshit/LightingDesignSystem/master/salesforce-lightning-design-system-v0.8.0/assets/styles/salesforce-lightning-design-system-vf.min.css" />
@RatanPaul
RatanPaul / Docusign IN_Person
Last active March 25, 2016 05:43
Docusign IN_Person
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
var rc = GetRelContentIDs("{!Opportunity.Id}");
var CCRM = 'Salesforce Administrator~Signer 1;Decision Maker~Signer 2';
var CCTM = 'Salesforce Administrator~Sign In Person;Decision Maker~Signer';
var CRL="Email~{!JSENCODE($User.Email)};Role~Salesforce Administrator;FirstName~{!JSENCODE($User.FirstName)};LastName~{!JSENCODE($User.LastName)};SignInPersonName~ {!Opportunity.Account};SignNow~1;RoutingOrder~1,Email~{!JSENCODE(Opportunity.OwnerEmail)};Role~Decision Maker;FirstName~{!Opportunity.OwnerFirstName};LastName~{!Opportunity.OwnerLastName};RoutingOrder~2";
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&rc="+rc+"&CCTM="+CCTM+"&CRL="+CRL+"&CCRM="+CCRM;
@RatanPaul
RatanPaul / VisualforceDrilldownChart.page
Created March 2, 2016 12:09 — forked from sohalloran/VisualforceDrilldownChart.page
Visualforce Charting with drill down when clicking on chart sections/bars
<apex:chart height="300" width="300" data="{!data}”>
<apex:axis type="Category" position="bottom" fields="ctype">
<apex:chartLabel rotate="270"/>
</apex:axis>
<apex:axis type="Numeric" position="left" fields="cval"/>
<apex:barSeries axis="left" orientation="vertical" xField="ctype" yField="cval">
<apex:chartTips rendererFn="renderer"/>
</apex:barSeries>
</apex:chart>
@RatanPaul
RatanPaul / CustomAccountLookup.page
Created February 17, 2016 12:12 — forked from jeffdonthemic/CustomAccountLookup.page
Roll Your Own Salesforce "Lookup" Popup Window blog post
<apex:page controller="CustomAccountLookupController"
title="Search"
showHeader="false"
sideBar="false"
tabStyle="Account"
id="pg">
<apex:form >
<apex:outputPanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
<apex:tabPanel switchType="client" selectedTab="name1" id="tabbedPanel">
@RatanPaul
RatanPaul / ScheduledDispatcher.cls
Created February 4, 2016 12:35 — forked from gbutt/ScheduledDispatcher.cls
apex scheduled dispatcher - this is how you can schedule code in SFDC without locking up all your classes
/***
This class can be used to schedule any scheduled job without risk of locking the class.
DO NOT CHANGE THIS CLASS! It is locked by the scheduler. Instead make changes to ScheduledHelper or your own IScheduleDispatched class
To use:
1) Create a new class to handle your job. This class should implement ScheduledDispatcher.IScheduleDispatched
2) Create a new instance of ScheduledDispatcher with the type of your new class.
3) Schedule the ScheduledDispatcher instead of directly scheduling your new class.
See ScheduledRenewalsHandler for a working example.
***/
global class ScheduledDispatcher implements Schedulable {
@RatanPaul
RatanPaul / BatchJob.cls
Created January 5, 2016 10:11 — forked from mjgallag/BatchJob.cls
Scheduled Batch Job Test Example
global class BatchJob implements Database.Batchable<Account> {
global Account[] start(Database.BatchableContext batchableContext) {return new Account[]{};}
global void execute(Database.BatchableContext batchableContext, Account[] accounts) {}
global void finish(Database.BatchableContext batchableContext) {}
}
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@RatanPaul
RatanPaul / gist:dba99dc31cee53a6c9cf
Created January 4, 2016 07:48 — forked from henriquez/gist:3146782
Example Javascript that uses ajax proxy to make request to Chatter API
<apex:page controller="CustomerCommunityController" id="customercommunitycontroller" sidebar="false" showHeader="false" standardStylesheets="false" >
<head>
<title>Acme Customer Support</title>
<meta charset="utf-8" />
<apex:includeScript value="{!$Resource.jquery}"/>
</head>
<script type="text/javascript">