Skip to content

Instantly share code, notes, and snippets.

View kiran-machhewar's full-sized avatar

Kiran Machhewar kiran-machhewar

View GitHub Profile
package metadata;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Calendar;
import java.util.List;
import com.sforce.soap.metadata.*;
import com.sforce.soap.partner.PartnerConnection;
<apex:page controller="CallOutUtil" standardStylesheets="false" showHeader="false" sidebar="false">
<customTag><apex:outputText value="{!data}" escape="false"/></customTag>
</apex:page>
public with sharing class CallOutUtil {
public String data {get;set;}
public CallOutUtil(){
data = getContent(ApexPages.currentPage().getParameters().get('url'));
//encoding data so as to avoid any data loss
data = EncodingUtil.base64Encode(Blob.valueOf(data));
}
Account acc = new Account(Name='My Account');
insert acc; //you can make dml before callout :)
System.debug(CallOutUtil.doCallout('https://www.google.co.in/search?q=heroku'));
delete acc;
function addXMLRequestCallback() {
var oldSend, oldonreadystatechange;
/*saving the orginal method*/
oldSend = XMLHttpRequest.prototype.send;
/*overrideing the default behaviour*/
XMLHttpRequest.prototype.send = function() {
/*calling the default behaviour*/
oldSend.apply(this, arguments);
oldonreadystatechange = this.onreadystatechange;
this.onreadystatechange = function ( progress ) {
<apex:component controller="PicklistController" >
<apex:attribute name="value" required="true" type="String" description="Provide the field binding"/>
<apex:attribute name="objectName" required="true" type="String" description="Provide object name"/>
<apex:attribute name="valueField" required="true" type="String" description="Provide the value field for the picklist"/>
<apex:attribute name="labelField" required="true" type="String" description="Provide the label field which needs to be shown in picklist"/>
<apex:attribute name="styleClass" required="false" type="String" description="Style class for the select list"/>
<apex:attribute name="required" required="false" type="Boolean" default="false" description="Id of picklist component"/>
<apex:attribute name="style" required="false" type="Boolean" default="" description="Style for the select list"/>
<apex:attribute name="filterFields" required="false" type="String"
/**
* ApexClass : PicklistController
* Description : Controller to the piklist component.
*/
global class PicklistController{
public String uniqueId {get;set;} //Uniquie id so that every components javscript code should be separate
/**
* CONSTRUCTOR
<apex:page standardController="Opportunity">
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"/>
<apex:form >
<apex:pageMessages id="pageMessages"/>
<apex:pageBlock title="Custom Picklist Demo">
<apex:pageBlockSection >
<apex:repeat value="{!$ObjectType.Opportunity.Fieldsets.PicklistDemoFields}" var="field">
<apex:inputField value="{!opportunity[field]}" rendered="{!$ObjectTYpe.Opportunity.fields[field].Type!='reference'}"/>
<apex:pageBlockSectionItem rendered="{!$ObjectTYpe.Opportunity.fields[field].Type=='reference'}" >
<apex:outputLabel value="{!$ObjectType.Opportunity.fields[field].Label}"/>
public class Notification{
/**
* @description :
* @param jobName Name of the scheduler
* @param durationInMinutes Greater duration than the time interval between scheduler executions.
*/
public static void addNotificationFor(String jobName, Integer durationInMinutes){
Notification__c notification = new Notification__c(
Name = jobName,
External_Code__c = jobName,
public class Notification{
/**
* @description :
* @param jobName Name of the scheduler
* @param durationInMinutes Greater duration than the time interval between scheduler executions.
*/
public static void addNotificationFor(String jobName, Integer durationInMinutes){
Notification__c notification = new Notification__c(
Name = jobName,
External_Code__c = jobName,