Ads

Tuesday 25 June 2013

Summer13 Release Features

Some Of The available Features With summer13 are  Listed Below,

  1.Approval Processes now available in change sets and exposed through the Metadata API
  2.Publisher actions are available in change sets and are supported in both managed and unmanaged packages.
  3.Summer ’13 introduces a new computer-telephony integration (CTI) Visualforce component—     support:clickToDia.
4.Summer ’13 introduces a new Visualforce component, chatter:userPhotoUpload that lets users upload a photo to their Chatter profile page
  5.The maximum size for a SOQL query has been increased to 20,000 characters
  6.Use Chatter in Apex to build Chatter integrations and custom UIs without making HTTP callouts Because Chatter in Apex exposes many Chatter API resources as Apex classes in the ConnectApi namespace
  7.Global Actions
  8. Communities

Thursday 20 June 2013

Adding Rows Dynamically to Page block Table ?

Apex:

public class MemberPopup
{
    public List<Account> memberList {get;set;}
    public List<Account> memberAddList {get;set;}
    public String memberName {get;set;}      
    public MemberPopup()
    {
        String sql = 'SELECT Name,Company__c FROM Account';
        memberList = Database.Query(sql);
        memberAddList = new List<Account>();
        memberAddList.add(new Account());
    }  
    public void AddRow()
    {
        memberAddList.add(new Account());
    }
}



VF Page:

<apex:page controller="MemberPopup" >
<apex:form >
    <apex:pageBlock id="membAdd" >                
        <apex:pageblockSection >
            <apex:pageBlockTable value="{!memberAddList}" var="m" >
                <apex:column headerValue="Member Name">
                    <apex:inputField value="{!m.Name}"/>
                </apex:column>
                <apex:column headerValue="Mobile Number">
                    <apex:inputField value="{!m.Company__c}"/>
                </apex:column>
                <apex:column headerValue="eMail Id">
                    <apex:inputField value="{!m.Account_Status__c}"/>
                </apex:column>
            </apex:pageBlockTable>
            <br/><apex:commandLink value="Add Row" action="{!addRow}" reRender="membAdd"/>      
        </apex:pageblockSection>      
        <apex:pageblockSection columns="1" >
            <apex:pageblockSectionItem >
                <apex:commandButton value="Save" />
                <apex:commandButton value="Cancel" />
            </apex:pageblockSectionItem>       
        </apex:pageblockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>



how to get a picklist values in apex controller?

Apex:
public class PicklistController{

    public Lead lead{get;set;}
    public List<SelectOption> statusOptions {get;set;}
   
    // Constructor called when page is accessed.
    public PicklistController() {   
        lead = new Lead();       
        statusOptions = new List<SelectOption>();

        // Use DescribeFieldResult object to retrieve status field.
        Schema.DescribeFieldResult statusFieldDescription =  Lead. Status.getDescribe();
        // For each picklist value, create a new select option
        for (Schema.Picklistentry  picklistEntry: statusFieldDescription.getPicklistValues())
{
            statusOptions.add(new SelectOption( pickListEntry.getValue(),pickListEntry.getLabel()));
            // obtain and assign default value
         
        }    
    }
}

VF Page:
<apex:page controller="PicklistController">
    Please selectValue:
    <apex:form >
        <apex:selectList size="1" value="{!led.Status}">
            <apex:selectOptions value="{!statusOptions}"/>
        </apex:selectList>
    </apex:form>  
</apex:page>

Screen Shot:





Sunday 26 May 2013

Difference between SOAP and Restful Webservice?

* REST and SOAP are the two web service frameworks available on the Force.com platform. 
* The SOAP API uses authentication with username and password, and communicates using XML messages. There are different API's to work with the Enterprise, Partner, Bulk, Metadata etc. 
*The REST API uses HTTP to authenticate, it uses a token authentication and can use OATH to authenticate, it communicates using JSON messages. 
*REST API is generally lighter weight than the SOAP API, works well with mobile applications especially.


how to lock a record?

To lock a set of sObject records in Apex, embed the keywords FOR UPDATE after any inline SOQL statement

To display all the fields of sObject using Apex & VF?

<apex:page showHeader="false" Controller="FieldsClass">
        <apex:DataTable value="{!data}" var="d">
             <apex:column headerValue="Field Name">
                 {!d}
             </apex:column>         
         </apex:DataTable>
</apex:page>
*******************************
public class  FieldsClass {

     public map<string,Schema.SObjectField> data {get;set;}
  
     public  FieldsClass (){
         data = Schema.SObjectType.Book__c.fields.getMap();
        }
    }

We have three country buttons, if we click any button that country information should only display?

Apex:
public class coun {

    public Boolean hide = false;
    public Boolean hide1 = false;
    public Boolean hide2 = false;
    
    public void setMhide(Boolean b) {
    this.hide = b;
    }
    
    public Boolean getMhide() {
    return this.hide;
    }//Passing input dynamically through another method
    
    
    public Boolean getM1hide() {
        return this.hide2;
    }
    
    public void setM1hide(Boolean b) {
      this.hide2 = b;  
    }
    
    
    public Boolean getM2hide() {
        return this.hide1;
    }
    
    public void setM2hide(Boolean b) {
        this.hide1 = b;
    }
    
    
    public PageReference india() {
        setMhide(true);
        setM2hide(false);
        setM1hide(false);     
        return null;
    }//displaying only india information and hiding other information
    
     public PageReference us() {
        setM1hide(true);
        setM2hide(false);
        setMhide(false);
        return null;
    }
    
    public PageReference uk() {
        setM2hide(true);
        setM1hide(false);
        setMhide(false);
        return null;
    }   
    
}
Vf Page:
<apex:page controller="coun">
<apex:form >

<apex:commandButton value="India" action="{!india}" reRender="India,Us,Uk"/>
<apex:commandButton value="Us" action="{!us}" reRender="India,Us,Uk"/>
<apex:commandButton value="Uk" action="{!uk}" reRender="India,Us,Uk"/>

<apex:pageBlock >

<apex:outputPanel id="India">
<apex:pageBlockSection title="India" rendered="{!mhide}">
</apex:pageBlockSection>
</apex:outputPanel>
<apex:outputpanel id="Us">
<apex:pageBlockSection title="US" rendered="{!m1hide}">
</apex:pageBlockSection>
</apex:outputpanel>

<apex:outputpanel id="Uk">
<apex:pageBlockSection title="UK" rendered="{!m2hide}">
</apex:pageBlockSection>
</apex:outputpanel>

</apex:pageBlock>

</apex:form>
</apex:page>