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="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}"/> |
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
/** | |
* 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 |
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: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" |
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
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 ) { |
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
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; |
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 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)); | |
} |
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 controller="CallOutUtil" standardStylesheets="false" showHeader="false" sidebar="false"> | |
<customTag><apex:outputText value="{!data}" escape="false"/></customTag> | |
</apex:page> |
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 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; |
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:component > | |
<style> | |
body.wait, body.wait *{ | |
cursor: wait !important; | |
} | |
</style> | |
<script> | |
//overriding the default send function of XMLHttpRequest | |
function addXMLRequestCallback() { | |
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="<Your custom/standard object api name>"> | |
<apex:detail subject="{!<Your custom/standard object api name>.Id}" relatedList="true" title="true"/> | |
</apex:page> | |