Skip to content

Instantly share code, notes, and snippets.

View anurragjainsfdc's full-sized avatar

anurragjainsfdc

View GitHub Profile
@anurragjainsfdc
anurragjainsfdc / Radio_Ex
Created December 18, 2013 08:45
Controller and VF Page for adding Radio button on VF Page.
public class Radio_Ex{
Public String answer{set;get;}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Yes','Yes'));
options.add(new SelectOption('No','No'));
return options;
}
}
@anurragjainsfdc
anurragjainsfdc / PDF_Page
Last active January 1, 2016 04:49
PDF_Page is the VF Page which is call from the custom button. PDF_Page_demo is the page from where the controller method is not calls for save PDF to avoid recursive calling of Page. PDF_Page_Controller for saving attachment.
<apex:page renderAs="pdf" standardController="Lead" extensions="PDF_Page_Controller" action="{!savePDF}">
This is the Pdf page of Lead "{!lead.Name}".
</apex:page>
@anurragjainsfdc
anurragjainsfdc / SaveBarCode
Last active January 2, 2016 09:09
VF page for Saving BarCode to the Product object.
<apex:page controller="saveBarCodeController" id="PAGE" sidebar="false">
<script>
function checkLength(){
var upc = document.getElementById("PAGE:FORM:BLK:PBSEC:PBSITEM:UPC").value;
if(upc.length != 12){
alert("Entered Code must be of 12 Digits.");
return false;
}else{
return true;
}
@anurragjainsfdc
anurragjainsfdc / DynamicTab
Last active January 3, 2016 13:48
Dynamically pick Tab Color
<apex:page standardController="Custom_Object__c" sidebar="false" showHeader="false" id="ThePage">
<style>
.txt{
font-size: large;
}
.txtSelected{
color: white;
}
.txt:hover{
<apex:page controller="EmailComposePageController" sidebar="false">
<apex:form style="width: 70%; margin-left: 15%;">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock title="Email">
TO::<apex:inputText style="width:100%" value="{!emailVal}"/><br>
CC::<apex:inputText style="width:100%" value="{!cc}"/> </br><br>
Subject::<apex:inputText style="width:100%" value="{!emailSubject}"/></br><br>
Attachment::<apex:inputFile value="{!att.body}" fileName="{!att.name}"/>
<apex:commandButton title="Upload" action="{!upload}" value="Upload"/><BR/>
<apex:repeat value="{!attList}" var="att">
<apex:page id="pageId">
<head>
<script src="/soap/ajax/20.0/connection.js" type="text/javascript"></script>
<script>
window.onload = function() {
var output = document.getElementById("output");
var startTime = new Date().getTime()
try {
sforce.connection.sessionId = "{!$Api.Session_ID}"; //Used for Session out
var queryResult = sforce.connection.query("Select Name, Industry From Account where Name != null");
<apex:page>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"/>
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script>
// jquery funtion for pop up.
$(function () {
$('#a').click(function(){
@anurragjainsfdc
anurragjainsfdc / AccountHierarchyChart
Last active November 8, 2017 06:59
Contact's Hierarchy Chart on vf-page by using Google chart.
<apex:page StandardController="Account" extensions="AccountHierarchyChartController" sidebar="false" showHeader="false">
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['orgchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
<apex:page id="Page" sidebar="false">
<script src="/soap/ajax/20.0/connection.js" type="text/javascript"></script>
<script>
function insertAccount(){
// Getting Session ID.
sforce.connection.sessionId = "{!$Api.Session_ID}";
//Creating New Account Record.
var account = new sforce.SObject("Account");
//Getting Account Name from inputText.
<apex:page standardController="Opportunity">
<apex:pageBlock title="{!Opportunity.Name}">
<apex:pageblocktable value="{!Opportunity.OpportunityLineItems}" var="oli">
<apex:column value="{!oli.PricebookEntry.Name}"/>
<apex:column value="{!oli.Quantity}"/>
<apex:column value="{!oli.UnitPrice}">
<apex:facet name="footer">
<apex:outputText value="Total:" style="float: right;"/>
</apex:facet>