Skip to content

Instantly share code, notes, and snippets.

@atulgupta31
atulgupta31 / test123
Created October 10, 2015 09:34
Trigger Template
/*
Description :
*/
trigger triggerOnSobject on sObject(before insert, after insert, before update, after update, before delete, after delete, after undelete) {
if (Trigger.isInsert) {
if (Trigger.isBefore) {
sObjectTriggerUtil.sObjectBeforeInsert(trigger.new);
}
if (Trigger.isAfter) {
sObjectTriggerUtil.sObjectAfterInsert(trigger.new);
@atulgupta31
atulgupta31 / vfc_pieSeries
Last active October 29, 2015 12:08
apex:chart
public class vfc_pieSeries{
public vfc_pieSeries(){
}
public List<PieWedgeData> getPieData() {
List<PieWedgeData> data = new List<PieWedgeData>();
List<AggregateResult> opps = [SELECT SUM(Amount) monthlyRevenue, COUNT(Name) numOppsClosedWon,
CALENDAR_MONTH(CloseDate) theMonth
public class vfc_apexbarSeries {
public List<AggregateResult> getData() {
return
[SELECT SUM(Amount) monthlyRevenue, COUNT(Name) numOppsClosedWon,
CALENDAR_MONTH(CloseDate) theMonth
FROM Opportunity
WHERE stageName = 'Closed Won' AND CALENDAR_YEAR(CloseDate) = 2011
GROUP BY CALENDAR_MONTH(CloseDate)
ORDER BY CALENDAR_MONTH(CloseDate)];
}
public class vfc_areaSeries {
public vfc_areaSeries(){
}
public List<Data> getData(){
List<Data> data = new List<Data>();
data.add(new Data('Jan', 30, 90, 55));
<apex:page controller="vfc_apexbarSeries" showHeader="false" readOnly="true">
<apex:chart width="600" height="275" data="{!data}">
<apex:axis type="Numeric" position="right" fields="monthlyRevenue" title="Revenue (US$)">
<apex:chartLabel rotate="60"/>
</apex:axis>
<apex:axis type="Category" position="bottom" fields="theMonth" title="2011">
</apex:axis>
<apex:barSeries title="Monthly Sales" orientation="vertical" axis="right" xField="theMonth" yField="monthlyRevenue"/>
</apex:chart>
</apex:page>
<apex:page controller="vfc_apexbarSeries" showHeader="false" readOnly="true">
<apex:chart width="600" height="275" data="{!data}">
<apex:axis type="Numeric" position="right" fields="monthlyRevenue" title="Revenue (US$)">
<apex:chartLabel rotate="60"/>
</apex:axis>
<apex:axis type="Category" position="bottom" fields="theMonth" title="2011">
</apex:axis>
<apex:barSeries title="Monthly Sales" orientation="vertical" axis="right" xField="theMonth" yField="monthlyRevenue">
<apex:chartTips height="20" width="120"/>
</apex:barSeries>
<!-- Page: -->
<apex:page standardController="Account" id="pg">
<apex:form id="frm">
<apex:pageBlock title="My Content" mode="edit" >
<apex:pageBlockButtons >
<apex:commandButton value="Save" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.site}"/>
<!-- Page: -->
<apex:page sidebar="false" showHeader="false">
<c:apexAttribute_component myValue="My component's value" borderColor="red" borderStyle="dotted"/>
</apex:page>
<!-- Component:myComponent -->
<apex:component >
<apex:attribute name="myValue" description="This is the value for the component." type="String" required="true"/>
<apex:attribute name="borderColor" description="This is color for the border." type="String" required="true"/>
<apex:attribute name="borderStyle" description="This is style of border ." type="String" required="true"/>
<h1 style="border-color:{!borderColor}; border-style: {!borderStyle}">
<apex:outputText value="{!myValue}"/>
</h1>