Skip to content

Instantly share code, notes, and snippets.

View srujan21's full-sized avatar

GANGASRUJAN GURUDU srujan21

View GitHub Profile
@srujan21
srujan21 / 0_reuse_code.js
Created June 2, 2016 09:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@srujan21
srujan21 / custombutton.cls
Created November 22, 2016 15:12 — forked from sbob-sfdc/custombutton.cls
Workshop 201, Tutorial 4, Step 1, Apex
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")}
var result = sforce.apex.execute("InvoiceUtilities","renumberLineItems",{invoice:"{!Invoice__c.Name}"});
alert(result);
window.location.reload();
@srujan21
srujan21 / EmailLogic.cls
Created December 7, 2017 10:16 — forked from jsullivanlive/EmailLogic.cls
Salesforce Email Merge
public class EmailLogic {
public static String renderTemplate(sObject sobj, String template) {
for (String fieldName : fields(sobj.getSObjectType())) {
String key = '{!' + fieldName + '}';
while (template.containsIgnoreCase(key)) {
try {
Integer foundPosition = template.indexOfIgnoreCase(key, 0);
template = template.left(foundPosition) +
String.valueOf(sobj.get(fieldName)) +