This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is my first gist. I will add reusable code pieces here, so that code development will be faster. I am targetting to put code related to | |
# Apex | |
# Visualforce | |
# HTML | |
# Javascript | |
# jQuery | |
# CSS | |
# Java | |
Testing updatet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************************** | |
*Apex Class Name : Name of the class ehre | |
*Version : 1.0 | |
*Created Date : 26 JAN 2014 | |
*Function : One or two line description the class. | |
* | |
*Modification Log: | |
* Developer Date Description | |
* ---------------------------------------------------------------------------- | |
* Author Name 01/26/2015 Original Version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class Sample_ControllerExtension { | |
private sObject mysObject; | |
// The extension constructor initializes the private member | |
// variable mysObject by using the getRecord method from the standard | |
// controller. | |
public Sample_ControllerExtension(ApexPages.StandardController stdController) { | |
this.mysObject = (sObject)stdController.getRecord(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Add{ | |
public static void main(String[] args){ | |
Scanner scan = new Scanner(System.in); | |
int a = scan.nextInt(); | |
int b = scan.nextInt(); | |
int c = a+b; | |
System.out.println(c); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Querying all parent records | |
for(Parent__c parent: [SELECT Id,name,Status__c FROM Parent__c]) | |
{ | |
if(parent.Status__c =='Completed') | |
{ | |
//If parent status is Completed querying all child records. | |
List<child__c> childList = [SELECT Id,Name,Parent__c, child_Status__c FROM Child__c WHERE Parent__c=:parent.id]; | |
for(child__c child:childList) | |
{ | |
//Changing child status as completed and updating record. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Declaring initial list to hold list of child records for single update at last | |
List<child__c> childUpdateList = new List<child__c>(); | |
//Child query is used to return both child and parent records in single query | |
for(Parent__c parent: [SELECT Id,name,Status__c,(SELECT Id,Name,Parent__c, child_Status__c FROM Child__r) | |
FROM Parent__c]) | |
{ | |
if(parent.Status__c =='Completed') | |
{ | |
//If parent status is completed child record status is changed and added into a list | |
for(child__c child:parent.Child__r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardcontroller="Account"> | |
<apex:pageblock title="Account Details"> | |
<apex:pageblocksection> | |
<apex:pageblocksectionitem>{!account.Name}</apex:pageblocksectionitem> | |
</apex:pageblocksection> | |
</apex:pageblock> | |
<apex:pageblock title="Contacts"> | |
<apex:form> | |
<apex:datatable border="1" cellpadding="4" value="{!account.Contacts}" var="contact"> | |
<apex:column> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package partner; | |
import com.sforce.soap.partner.Connector; | |
import com.sforce.soap.partner.DeleteResult; | |
import com.sforce.soap.partner.PartnerConnection; | |
import com.sforce.soap.partner.QueryResult; | |
import com.sforce.soap.partner.SaveResult; | |
import com.sforce.soap.partner.Error; | |
import com.sforce.soap.partner.sobject.SObject; | |
import com.sforce.ws.ConnectionException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page showheader="false" sidebar="false" controller="myAttendanceController"> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<apex:include pageName="header"/> | |
<script type="text/javascript"> | |
google.load("visualization", "1", {packages:["corechart"]}); | |
google.setOnLoadCallback(drawChart); | |
function drawChart() { | |
var data = google.visualization.arrayToDataTable([ | |
['Status', 'Count'], | |
['Attended', {!attendedCount}], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class myAttendanceController { | |
public Id contactId; | |
public Integer attendedCount{get;set;} | |
public Integer partialCount{get;set;} | |
public Integer absentCount{get;set;} | |
public myAttendanceController(){ | |
attendedCount = 0; | |
partialCount = 0; | |
absentCount = 0; | |
User loggedInUser = [Select Id,contactId FROM User WHERE ID=:userinfo.getUserId()]; |
OlderNewer