Skip to content

Instantly share code, notes, and snippets.

@swapnilshrikhande
swapnilshrikhande / ddMMyyyy formated formula
Created March 24, 2017 06:41
sf ddMMyyyyformatedformula
IF( DAY(Invoice_Date__c)<10,'0','' )
& TEXT(DAY(Invoice_Date__c))
&'/'&
IF( MONTH(Invoice_Date__c)<10,'0','' )
& TEXT(MONTH(Invoice_Date__c))
&'/'&
TEXT(YEAR(Invoice_Date__c))
@RemoteAction
public static map<String,map<String,String>> getValidationRule() {
map<String,map<String,String>> mapObjectValidationRule = new map<String,map<String,String>>();
// get list of the validation rules associated with the object
String domainUrl = URL.getSalesforceBaseUrl().toExternalForm();
HttpRequest req = new HttpRequest();
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
req.setHeader('Content-Type', 'application/json');
req.setEndpoint(domainUrl+'/services/data/v36.0/tooling/query/?q=Select%20id%2CValidationName%2CActive%2CEntityDefinitionId%20From%20ValidationRule');
Requirement Analysis:
Proposed Solution:
Technical Solution: classes
Estimation:
Dev:
Test Methods
Dev Unit Test
Clarification:
public interface Organism {
}
public interface Part {
List<Limb>
}
public interface Limb {
//can be composed of Cells
@swapnilshrikhande
swapnilshrikhande / event-bubble.html
Last active December 20, 2016 08:39
Event Bubble Demo
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="./jquery-1.11.3.js"></script>
</head>
<style type="text/css">
.target{
border: 5px groove black;
padding : 50px;
@swapnilshrikhande
swapnilshrikhande / SplitContactName.cls
Created December 18, 2016 08:36
Split Contact Name Into First, Middle and Last name components.
String s = 'FirstName MiddleName LastName AnotherName';
String[] arrayS = s.split(' ', 3);
System.debug ( 'First :- '+ getFirstName(arrayS) );
System.debug ('Middle :-'+ getMiddleName(arrayS) );
System.debug ('Last Name :-'+ getLastName(arrayS) );
s = 'FirstName MiddleName LastName';
arrayS = s.split(' ', 3);
System.debug ( 'First :- '+ getFirstName(arrayS) );
input[type=checkbox] {
opacity: 1;
float:left;
}
input[type=checkbox] {
margin: 0 0 0 20px;
position: relative;
cursor: pointer;
font-size: 16px;
public abstract class AccountTrigger {
public Account[] accountOldList { set; get; }
public Account[] accountNewList { set; get; }
public Map<Id, Account> accountOldListMap = new Map<Id, Account>();
public Map<Id, Account> accountNewListMap = new Map<Id, Account>();
public AccountTrigger(Account[] accountOldList, Account[] accountNewList) {
this.accountOldList = accountOldList == null ? new Account[] {} : accountOldList;
this.accountNewList = accountNewList == null ? new Account[] {} : accountNewList;
@swapnilshrikhande
swapnilshrikhande / ClientIpAddress.java
Last active December 12, 2016 15:08
Get clients IP from the request packet.
public final class ClientIpAddress {
// CHECKSTYLE:OFF
// http://stackoverflow.com/a/11327345/131929
private static Pattern PRIVATE_ADDRESS_PATTERN = Pattern.compile(
"(^127\\.)|(^192\\.168\\.)|(^10\\.)|(^172\\.1[6-9]\\.)|(^172\\.2[0-9]\\.)|(^172\\.3[0-1]\\.)|(^::1$)|(^[fF][cCdD])",
Pattern.CANON_EQ);
// CHECKSTYLE:ON
private ClientIpAddress() {
@swapnilshrikhande
swapnilshrikhande / Pdf_of_Attachment
Created December 2, 2016 09:00 — forked from SeemaKurawale111/Pdf_of_Attachment
Generate PDF attachment of opprtunity details
<apex:page standardController="Opportunity" extensions="Pdf_of_Attachment_Extension" renderAs="pdf">
<apex:pageBlock >
<apex:pageBlockSection columns="1" >
<apex:pageBlockSectionItem >Opportunity Name: {!Opportunity.Name} </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >CloseDate : {!Opportunity.CloseDate} </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >StageName : {!Opportunity.StageName} </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >Probability : {!Opportunity.Probability} </apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:repeat var="attachment" value="{!attachments}">
<apex:image url="/servlet/servlet.FileDownload?file={!attachment.Id}"/><br></br>