• learning1.3953795511514497E12
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 12
    Replies
Hi I have a requiment where I need to use standardSetController to have 10,000 records in a table with pagination and the ckeckboxes.
I have refered the following sites.
http://blog.jeffdouglas.com/2009/07/14/visualforce-page-with-pagination/
http://blog.cloudclickware.com/tag/standardsetcontroller/

both work absolutely fine when I use getter method to get the values of lists used in pageblcock table.
e.g :
1 :In first link
<apex:pageBlockTable title="Contacts" value="{!contacts}" var="c">
 public List<CCWRowItem> getContacts()
{
      ---
}

2: In second link

<apex:pageBlockTable value="{!categories}" var="c">
public List<categoryWrapper> getCategories()
{
   ---
}

My requirement is quite different.
I need to set the value of list in the command buttonsa action method as shown below

VF Page
 -  - -
 - - -
<apex:commandButton action="{!DisplayTable}" value="Display Table" />
- - -
<apex:pageBlockTable value="{!tempContactList}" var="c">
   // columns
</apex:pageBlockTable>

partial Controller
- - -
-  - -

 public class WrapperClass

    {
        public Boolean isSelected {get; set;}
        public string conId {get; set;}
        public Temporary_Contact__c tempcon{get; set;}                
        
        public MassCreationOfContactsWrapper(Temporary_Contact__c tc)
        {            
            this.tempcon = tc;
            this.isSelected = false;
            this.conId = tc.id;
        }
    }
- -  -
 public ApexPages.StandardSetController setCon
    {
        get{
            if(setCon == null){
                size = 1000;
                string queryString = 'SELECT id,Name,First_Name__c,Last_Name__c,Email__c,Desk_Group__c from Temporary_Contact__c Where Email__c like  \'%@'+ emailDomain +'%\'  LIMIT 10000';                
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
                setCon.setPageSize(size);
                noOfRecords = setCon.getResultSize();
            }
            return setCon;
        }set;
    } 
- - -
public void DisplayTable()
{
       tempContactList = new List<wrapperClss>();     
        for(Temporary_Contact__c tc : (List<Temporary_Contact__c>)setCon.getRecords())
        {
            tempContactList.add(new wrapperClss(tc));
        }
}


When I do this my table is not refreshing after clicking on pagination buttons
Please help
Thanks,


 
I have the below code.

public class mycontroller
{
           public ApexPages.StandardSetController con{       
        get {
            Id accId = system.currentPageReference().getParameters().get('Id');
            str = String.valueOf(accId).left(3);
            if(accId!=null && str == '001')
           {
                if(con!=null)
                {
                             con = new ApexPages.StandardSetController(Database.getQueryLocator([select id from relationship__c where acccount__c =: Accid]));

                }
                        ---
                        ---
                        ---
           }
          return con;
          }
        set;
      }

}

I have tried with the below code but not entering into getter of the "public ApexPages.StandardSetController con" 

@isTest(seeAllData=True)
private class ViewConnectioncontrollerTest1
{
    static testMethod void  ViewConnectioncontrollerTestMethod()
    {       

        List<Account> acc = new List<Account>();
        acc = [select Id,Name from Account limit 1];                    
       
         ApexPages.currentPage().getParameters().put('accid', acc[0].id);
         System.debug('********* acc id ********' +acc[0].id);
         ApexPages.StandardSetController ssc = new ApexPages.Standardsetcontroller(acc);       
         ViewConnectioncontroller vcc = new ViewConnectioncontroller();
         vcc.con = ssc;
         // vcc.con.accid = acc[0].id;        
       
    }
}

pls help
Hi,

In visualforce page, I have a script where I am Invoking a RemoteAction Method.
In Remote action method I want to set the values for standard Account's fields.
I tried with the follwing code but no use...


Apex Controller :

==============================
public  class CreateAccountController
{
           public static Account acc;
           public CreateAccountController(ApexPages.StandardController controller)
           {
                     acc= (Account)controller.getRecord();
           } 

           @RemoteAction
            public static void popupData(String selectedRec)
             {      
                                    System.debug('*******************  Selected Rec :' +selectedRec);       
                                    acc.Name = selectedRec;   
              }

}


Here the RemoteAction method "popupData" is not setting the value in acc.Name field.
Pls help.

         
Hi,

How to implement autocomplete lookup in visualforce page.
I have come across many links where the autocomplete is shown with standard object. But in my case i need to do with webservice call.
i.e When i start typing in input textbox , after typing atleast 3 characters it should hit the webservice call.


Thanks.

Hi,

I have created a pageblocktable with pagination by refering to " http://www.redpointsolutions.com/add-pagination-to-your-visualforce-pages-using-the-soql-offset-clause ". My code is as below...

VF PAGE
==============

<apex:page title="Salesforce SOQL Offset Example Using Visualforce" controller="soql_offset_example" showHeader="false" sidebar="false" readOnly="true" cache="false">

<apex:sectionHeader subtitle="SOQL Offset Example" title="Square Root Table"/>

<apex:pageBlock >  
   <apex:pageBlockButtons location="top" >
   <apex:outputPanel id="myButtons">
   <apex:form >
        <apex:commandButton action="{!Beginning}" title="Beginning" value="<<" disabled="{!disablePrevious}" reRender="myPanel,myButtons"/>
        <apex:commandButton action="{!Previous}" title="Previous" value="<" disabled="{!disablePrevious}" reRender="myPanel,myButtons"/>       
        <apex:commandButton action="{!Next}" title="Next" value=">" disabled="{!disableNext}" reRender="myPanel,myButtons"/>
        <apex:commandButton action="{!End}" title="End" value=">>" disabled="{!disableNext}" reRender="myPanel,myButtons"/>       
   </apex:form>
   </apex:outputPanel>
   </apex:pageBlockButtons>

   <apex:pageBlockSection title="Numbers and their Square Roots (Total List Size: {!total_size})" collapsible="false">
   <apex:outputPanel id="myPanel">
   <apex:pageMessages id="theMessages" />
   <apex:pageBlockTable value="{!LinkedinCompanies}" var="l" align="center">
        <apex:column value="{!l.id}" />
        <apex:column value="{!l.name}" />
        <apex:facet name="footer">Showing Page # {!pageNumber} of {!totalPages}</apex:facet>
   </apex:pageBlockTable>
   </apex:outputPanel>
   </apex:pageBlockSection>

</apex:pageBlock>

</apex:page>

Controller
============
public with sharing class soql_offset_example {

   private integer counter=0;  //keeps track of the offset
   private integer list_size=5; //sets the page size or number of rows
   public integer total_size; //used to show user the total size of the list
   String linkedinResponse;
   public List<companyDetails> LinkedinCompanies{get;set;}
  
   public class companyDetails
    {
        public Integer id {get;set;}
        public String name {get;set;}
        public String universalName {get;set;}       
        Public String size {get;set;}
        Public String industry {get;set;}
        Public String ticker {get;Set;}
        public String logoURL{get;set;}
        public string websiteurl {get;set;}       
        public String description {get;set;}
        Public locationDetails locations{get;set;}
    }
   
    public class locationDetails
    {
        public integer lin_total{get;set;}
        public List<locationValues> values{get;set;}                        
    }
   
    public class locationValues
    {
        public addressDetails address{get;set;}
        public contactDetails contactInfo{get;set;}     
    }
   
    public class addressDetails
    {
        public String city{get;set;}  
        public String postalCode{get;set;}
        public String street1{get;set;}            
    }
   
    public class contactDetails
    {
        public String fax{get;set;}
        public String phone1{get;set;}     
    }   
       


   public soql_offset_example()
   {
       //total_size = 20; //set the total size in the constructor
       getNumbers();
   }

   public void  getNumbers() {
      try
      {
              
            linkedinResponse =  '{"companies": { "_count": 10, "_start": 0, "_total": 55573, "values": [ { "id": 10667, "industry": "Internet", "name": "Facebook" }, { "id": 3748947, "industry": "Marketing & Advertising", "name": "Community Management Facebook y Facebook Ads" }, { "id": 3219314, "industry": "Marketing & Advertising", "name": "Smart Facebook Likes" }, { "id": 2620756, "industry": "Information Technology & Services", "name": "Revolucionamos Facebook" }, { "id": 3326206, "industry": "Marketing & Advertising", "name": "Facebook-buy-fans.com" }, { "id": 2811427, "industry": "Marketing & Advertising", "name": "Empowers Facebook Marketing for Business" }, { "id": 2226401, "industry": "Marketing & Advertising", "name": "Facebook Advertising" }, { "id": 5059292, "industry": "Internet", "name": "Facebook Covers" }, { "id": 3100592, "industry": "Real Estate", "name": "Facebook Property Listing by propertybooster.com" }, { "id": 2453105, "industry": "Accounting", "name": "FaceBook Business Page Your Biz First" } ] }}';
             linkedinResponse =linkedinResponse.replace('"_', '"lin_');   
             System.debug('********** linkedinResponse *******' +linkedinResponse); 
                    
         
           Map<String, Object> linkedinRespCompanies = (Map<String, Object>) JSON.deserializeUntyped(linkedinResponse);                                           
           Map<String,Object> CompaniesMap = (Map<String,Object>)linkedinRespCompanies.get('companies');                   
           List<Object> CompaniesList = (List<Object>)CompaniesMap.get('values');                    
           String CompaniesListSerialized = JSON.serialize(CompaniesList);
           LinkedinCompanies = (List<companyDetails>) JSON.deserializeStrict(CompaniesListSerialized, List<companyDetails>.class);
          total_size = LinkedinCompanies.size();
      }
       catch (Exception e)
       {
         ApexPages.addMessages(e);  
        // return null;
      }
   }

   public PageReference Beginning() { //user clicked beginning
      counter = 0;
      return null;
   }

   public PageReference Previous() { //user clicked previous button
      counter -= list_size;
      return null;
   }

   public PageReference Next() { //user clicked next button
      counter += list_size;
      return null;
   }

   public PageReference End() { //user clicked end
      counter = total_size - math.mod(total_size, list_size);
      return null;
   }

   public Boolean getDisablePrevious() {
      //this will disable the previous and beginning buttons
      if (counter>0) return false; else return true;
   }

   public Boolean getDisableNext() { //this will disable the next and end buttons
      if (counter + list_size < total_size) return false; else return true;
   }

   public Integer getTotal_size() {
      return total_size;
   }

   public Integer getPageNumber() {
      return counter/list_size + 1;
   }

   public Integer getTotalPages() {
      if (math.mod(total_size, list_size) > 0) {
         return total_size/list_size + 1;
      } else {
         return (total_size/list_size);
      }
   }
}

Eventhough the button and footer are changing correctly,  but the actual data is not changing in table according the list_size mentioned. Please help...


Anu
Hi ,

I want to develop pagination for the pageblocktable with standardsetController. When I search online i m finding the codes where the standard controller and soql are used, as shown below...

private String baseQuery = 'Select ID, Name FROM Account ORDER BY NAME ASC';

public ApexPages.StandardSetController AccSetController {
        get{
            if(AccSetController == null){
                AccSetController = new ApexPages.StandardSetController(Database.getQueryLocator(baseQuery));
                AccSetController.setPageSize(pageSize);

                // We have to set FilterId after Pagesize, else it will not work
                if(AccFilterId != null)
                {
                  AccSetController.setFilterId(AccFilterId);
                }
            }
            return AccSetController;
        }set;
    }

but, in my case i m not using any soql, instead  I am using the wrapper classes . below is my code.

VF PAGE:
===========
<apex:page controller="TablePaginationController">
    <apex:form >
    <apex:pageBlock >
          <apex:pageblockTable value="{!LinkedinCompanies}" var="linkedinComp" id="linkedinCompaniesTable">
            
                        <apex:column headerValue="id" value="{!linkedinComp.id}" />
                        <apex:column headerValue="name" value="{!linkedinComp.name}" />

                    </apex:pageblockTable>           
                 </apex:pageBlock>
               </apex:form> 
</apex:page>

APEX :
=============
public with sharing class TablePaginationController
{

    public List<companyDetails> data { get; set; }
     public ApexPages.StandardSetController setCon;

  

    public List<companyDetails> LinkedinCompanies{get;set;}
   
    public Class companyDetails
    {
        public Integer id {get;set;}
        public String name {get;set;}
    }
   
    public void linkedinSearch()
    {
        try{
            String linkedinResponse = '{"companies": { "_count": 10, "_start": 0, "_total": 55556, "values": [ { "id": 10667, "name": "Facebook" }, { "id": 3748947, "name": "Community Management Facebook y Facebook Ads" }, { "id": 3219314, "name": "Smart Facebook Likes" }, { "id": 2620756, "name": "Revolucionamos Facebook" }, { "id": 3326206, "name": "Facebook-buy-fans.com" }, { "id": 2811427, "name": "Empowers Facebook Marketing for Business" }, { "id": 2226401, "name": "Facebook Advertising" }, { "id": 5059292, "name": "Facebook Covers" }, { "id": 3100592, "name": "Facebook Property Listing by propertybooster.com" }, { "id": 2453105, "name": "FaceBook Business Page Your Biz First" } ] }}';
            linkedinResponse = linkedinResponse.replace('"_', '"lin_');                
            Map<String, Object> linkedinRespCompanies = (Map<String, Object>) JSON.deserializeUntyped(linkedinResponse);          
            Map<String,Object> CompaniesMap = (Map<String,Object>)linkedinRespCompanies.get('companies');          
            String str = JSON.serialize(CompaniesMap.get('values'));                           
            List<companyDetails> LinkedinCompanies = (List<companyDetails>) JSON.deserializeStrict(str, List<companyDetails>.class);    
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFo,'' +LinkedinCompanies));
            data = LinkedinCompanies;
            }
            catch(Exception e)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Exception' +e));
            }
       
    }
   
}

how do i develop pagination for this?

Please help.

Anupama

I have a requirement where i need to customize the Account's "save" button in VF page. The save button should do the following.

1 : Save the record and go to that particular record's view page. (This is standard functionality)
2 : Get the record id from the url in addressbar.

I need the record id to create related list records for this particular Account.

OR

Is there any way to create the Account record and its child records at a time?

I should not create the related list records manually since the data is coming from external entity.I just need to dump that data to the related list .So I have to go through the above method only.

I have tried the below code but no luck...

In VF page
----------------
<apex:commandButton value="Save" action="{!SaveAndCreteLocations}"/>

In APex controller :
-------------------------------
public pageReference SaveAndCreteLocations()
    {
         pageReference pv = controller.view(); 
         controller.save();
         pv.setRedirect(true);
         return pv;  

    }


In the above code the record is saving but not going to the view page.
Please help...

public class jsonPoarse
{
      public class AdressDetail
    {
        public String city{get;set;}
        public String postalCde{get;set;}
        public String Street{get;set;}
    }
   
    public class ContactDetail
    {
        public String fax{get;set;}
        public String phone{get;set;}
    }
   class companyDetails
    {
           public integer id{get;set;}
           public integer name{get;set;}
           // public Map<locations> {get;set;}
    }
public Static void nestedJsonParse()
    {
        String jsonInput = '{"companies": { "_count": 3, "_start": 0, "_total": 236, "values": [ { "id": 1318, "locations": { "_total": 3, "values": [ { "address": { "city": "Bangalore", "postalCode": "560035", "street1": "Dodda Kannelli" }, "contactInfo": { "fax": "", "phone1": "" } }, { "address": { "city": "Bangalore", "postalCode": "560100", "street1": "Electronics City" }, "contactInfo": { "fax": "", "phone1": "" } }, { "address": { "city": "Kochi", "postalCode": "682030", "street1": "Info Park Special Economic Zone" }, "contactInfo": { "fax": "", "phone1": "91-484-3054949" } } ] }, "name": "Wipro" }, { "id": 1315, "locations": { "_total": 5, "values": [ { "address": { "city": "Bangalore", "postalCode": "560 035", "street1": "Doddakannelli," }, "contactInfo": { "fax": "+91 (80) 28440256", "phone1": "+91 (80) 28440011" } }, { "address": { "city": "Corniche Road, Al Khobar,", "postalCode": "", "street1": "Suite 209, Level II," }, "contactInfo": { "fax": "", "phone1": "+966 (3) 898 4015" } }, { "address": { "city": "London", "postalCode": "W2 6PS", "street1": "West Wing, Level 2," }, "contactInfo": { "fax": "+44 207 286 5703", "phone1": "+44 207 432 8500" } }, { "address": { "city": "North Sydney,", "postalCode": "NSW - 2060", "street1": "Level 17," }, "contactInfo": { "fax": "+61 (2) 9394 8199", "phone1": "+61 (2) 9394 8100" } }, { "address": { "city": "Mississauga,", "postalCode": "L4W 4T9", "street1": "5090 Explorer Drive" }, "contactInfo": { "fax": "(905) 629-0956", "phone1": "(289) 374-2000" } } ] }, "name": "Wipro Infotech" }, { "id": 1314, "locations": { "_total": 3, "values": [ { "address": {}, "contactInfo": {} }, { "address": {"postalCode": "10167"}, "contactInfo": {} }, { "address": { "city": "East Brunswick", "postalCode": "08816", "street1": "2 Tower Center Blvd" }, "contactInfo": {} } ] }, "name": "Wipro Consulting" } ] }}';
        Map<String, Object> jsonInputdeserialized = (Map<String, Object>) JSON.deserializeUntyped(jsonInput);
        System.debug('jsonInputdeserialized =' +jsonInputdeserialized);
        System.debug('MapKeys = ' +jsonInputdeserialized.keySet());  
        System.debug('mapValues = ' +jsonInputdeserialized.get('companies'));
       
        Map<String,Object> CompaniesMap = (Map<String,Object>)jsonInputdeserialized.get('companies');
        System.debug('CompaniesMap = ' +CompaniesMap);
        System.debug('CompaniesMap keys = ' +CompaniesMap.keySet());
        System.debug('CompaniesMap values = ' +CompaniesMap.get('values'));
       
//        Map<String,Object> valuesMap = (Map<String,Object>)CompaniesMap.get('values');

*********
Here I want to get the values of address,contactinfo , and total locations

******************


       
       
       
    }
}
Hi,

I have a custom component to display the pageblock table. I want to call it  through a button. When I click on the button then only the compnent should be called , but here it is calling before clicking on the button.

VF Code :
---------------------------

<apex:page standardController="Account" extensions="ArchivedRecordsInPageBlockTable" sidebar="False">
  
    <apex:form id="thefrm">   
        <apex:commandButton value="Display data" action="{!buttonCode}" rerender="ArchivedTableID"/>
       
    </apex:form>  
   
<apex:outputPanel id="callComponent">
    <c:DynamicObjectTable ObjectName="Case"  id="callComponent"
       FieldsetName="Test" DetailFields="DetailFieldsSet"    
       JSONData="{!jsonData}"
       Title="Archived Cases"
       TablePageSize="10"
    />  
   </apex:outputPanel>
    </apex:page>

Controller :
--------------------

public with sharing class ArchivedRecordsInPageBlockTable
{
public String jsonData {get;set;}

    public ArchivedRecordsInPageBlockTable(ApexPages.StandardController controller)
    {
           // fetchArchivedCasesCallout();
   
    }   
    private void fetchArchivedCasesCallout()
    {
       jsonData = '[{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"},{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"},{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"},{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"}]';         
            
    }   
   
    public void buttonCode()
    {
      //
    }
             
   
}

If " fetchArchivedCasesCallout() " is un commented from the constructor it directly calls the custom component. but i dnt want to call it directly .
I want to call it through the command button

I have the below code.

public class mycontroller
{
           public ApexPages.StandardSetController con{       
        get {
            Id accId = system.currentPageReference().getParameters().get('Id');
            str = String.valueOf(accId).left(3);
            if(accId!=null && str == '001')
           {
                if(con!=null)
                {
                             con = new ApexPages.StandardSetController(Database.getQueryLocator([select id from relationship__c where acccount__c =: Accid]));

                }
                        ---
                        ---
                        ---
           }
          return con;
          }
        set;
      }

}

I have tried with the below code but not entering into getter of the "public ApexPages.StandardSetController con" 

@isTest(seeAllData=True)
private class ViewConnectioncontrollerTest1
{
    static testMethod void  ViewConnectioncontrollerTestMethod()
    {       

        List<Account> acc = new List<Account>();
        acc = [select Id,Name from Account limit 1];                    
       
         ApexPages.currentPage().getParameters().put('accid', acc[0].id);
         System.debug('********* acc id ********' +acc[0].id);
         ApexPages.StandardSetController ssc = new ApexPages.Standardsetcontroller(acc);       
         ViewConnectioncontroller vcc = new ViewConnectioncontroller();
         vcc.con = ssc;
         // vcc.con.accid = acc[0].id;        
       
    }
}

pls help
Hi,

In visualforce page, I have a script where I am Invoking a RemoteAction Method.
In Remote action method I want to set the values for standard Account's fields.
I tried with the follwing code but no use...


Apex Controller :

==============================
public  class CreateAccountController
{
           public static Account acc;
           public CreateAccountController(ApexPages.StandardController controller)
           {
                     acc= (Account)controller.getRecord();
           } 

           @RemoteAction
            public static void popupData(String selectedRec)
             {      
                                    System.debug('*******************  Selected Rec :' +selectedRec);       
                                    acc.Name = selectedRec;   
              }

}


Here the RemoteAction method "popupData" is not setting the value in acc.Name field.
Pls help.

         
Hi,

How to implement autocomplete lookup in visualforce page.
I have come across many links where the autocomplete is shown with standard object. But in my case i need to do with webservice call.
i.e When i start typing in input textbox , after typing atleast 3 characters it should hit the webservice call.


Thanks.

I have a requirement where i need to customize the Account's "save" button in VF page. The save button should do the following.

1 : Save the record and go to that particular record's view page. (This is standard functionality)
2 : Get the record id from the url in addressbar.

I need the record id to create related list records for this particular Account.

OR

Is there any way to create the Account record and its child records at a time?

I should not create the related list records manually since the data is coming from external entity.I just need to dump that data to the related list .So I have to go through the above method only.

I have tried the below code but no luck...

In VF page
----------------
<apex:commandButton value="Save" action="{!SaveAndCreteLocations}"/>

In APex controller :
-------------------------------
public pageReference SaveAndCreteLocations()
    {
         pageReference pv = controller.view(); 
         controller.save();
         pv.setRedirect(true);
         return pv;  

    }


In the above code the record is saving but not going to the view page.
Please help...

public class jsonPoarse
{
      public class AdressDetail
    {
        public String city{get;set;}
        public String postalCde{get;set;}
        public String Street{get;set;}
    }
   
    public class ContactDetail
    {
        public String fax{get;set;}
        public String phone{get;set;}
    }
   class companyDetails
    {
           public integer id{get;set;}
           public integer name{get;set;}
           // public Map<locations> {get;set;}
    }
public Static void nestedJsonParse()
    {
        String jsonInput = '{"companies": { "_count": 3, "_start": 0, "_total": 236, "values": [ { "id": 1318, "locations": { "_total": 3, "values": [ { "address": { "city": "Bangalore", "postalCode": "560035", "street1": "Dodda Kannelli" }, "contactInfo": { "fax": "", "phone1": "" } }, { "address": { "city": "Bangalore", "postalCode": "560100", "street1": "Electronics City" }, "contactInfo": { "fax": "", "phone1": "" } }, { "address": { "city": "Kochi", "postalCode": "682030", "street1": "Info Park Special Economic Zone" }, "contactInfo": { "fax": "", "phone1": "91-484-3054949" } } ] }, "name": "Wipro" }, { "id": 1315, "locations": { "_total": 5, "values": [ { "address": { "city": "Bangalore", "postalCode": "560 035", "street1": "Doddakannelli," }, "contactInfo": { "fax": "+91 (80) 28440256", "phone1": "+91 (80) 28440011" } }, { "address": { "city": "Corniche Road, Al Khobar,", "postalCode": "", "street1": "Suite 209, Level II," }, "contactInfo": { "fax": "", "phone1": "+966 (3) 898 4015" } }, { "address": { "city": "London", "postalCode": "W2 6PS", "street1": "West Wing, Level 2," }, "contactInfo": { "fax": "+44 207 286 5703", "phone1": "+44 207 432 8500" } }, { "address": { "city": "North Sydney,", "postalCode": "NSW - 2060", "street1": "Level 17," }, "contactInfo": { "fax": "+61 (2) 9394 8199", "phone1": "+61 (2) 9394 8100" } }, { "address": { "city": "Mississauga,", "postalCode": "L4W 4T9", "street1": "5090 Explorer Drive" }, "contactInfo": { "fax": "(905) 629-0956", "phone1": "(289) 374-2000" } } ] }, "name": "Wipro Infotech" }, { "id": 1314, "locations": { "_total": 3, "values": [ { "address": {}, "contactInfo": {} }, { "address": {"postalCode": "10167"}, "contactInfo": {} }, { "address": { "city": "East Brunswick", "postalCode": "08816", "street1": "2 Tower Center Blvd" }, "contactInfo": {} } ] }, "name": "Wipro Consulting" } ] }}';
        Map<String, Object> jsonInputdeserialized = (Map<String, Object>) JSON.deserializeUntyped(jsonInput);
        System.debug('jsonInputdeserialized =' +jsonInputdeserialized);
        System.debug('MapKeys = ' +jsonInputdeserialized.keySet());  
        System.debug('mapValues = ' +jsonInputdeserialized.get('companies'));
       
        Map<String,Object> CompaniesMap = (Map<String,Object>)jsonInputdeserialized.get('companies');
        System.debug('CompaniesMap = ' +CompaniesMap);
        System.debug('CompaniesMap keys = ' +CompaniesMap.keySet());
        System.debug('CompaniesMap values = ' +CompaniesMap.get('values'));
       
//        Map<String,Object> valuesMap = (Map<String,Object>)CompaniesMap.get('values');

*********
Here I want to get the values of address,contactinfo , and total locations

******************


       
       
       
    }
}
Hi,

I have a custom component to display the pageblock table. I want to call it  through a button. When I click on the button then only the compnent should be called , but here it is calling before clicking on the button.

VF Code :
---------------------------

<apex:page standardController="Account" extensions="ArchivedRecordsInPageBlockTable" sidebar="False">
  
    <apex:form id="thefrm">   
        <apex:commandButton value="Display data" action="{!buttonCode}" rerender="ArchivedTableID"/>
       
    </apex:form>  
   
<apex:outputPanel id="callComponent">
    <c:DynamicObjectTable ObjectName="Case"  id="callComponent"
       FieldsetName="Test" DetailFields="DetailFieldsSet"    
       JSONData="{!jsonData}"
       Title="Archived Cases"
       TablePageSize="10"
    />  
   </apex:outputPanel>
    </apex:page>

Controller :
--------------------

public with sharing class ArchivedRecordsInPageBlockTable
{
public String jsonData {get;set;}

    public ArchivedRecordsInPageBlockTable(ApexPages.StandardController controller)
    {
           // fetchArchivedCasesCallout();
   
    }   
    private void fetchArchivedCasesCallout()
    {
       jsonData = '[{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"},{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"},{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"},{"LastReferencedDate": "", "SuppliedCompany": "", "Priority": "Medium", "OwnerId": "0059000000252PUAAY", "Type": "Electrical", "Status": "Closed", "CaseNumber": 85501, "ClosedDate": "2014-03-07T05:18:18.000Z", "IsEscalated": "false", "LastModifiedDate": "2014-03-07T05:18:18.000Z", "SuppliedPhone": "", "ContactId": "", "Reason": "Performance", "CreatedById": "0059000000252PUAAY", "LastViewedDate": "", "IsDeleted": "false", "SuppliedName": "", "SuppliedEmail": "", "LastModifiedById": "0059000000252PUAAY", "ParentId": "", "Description": "", "Origin": "Phone", "IsClosed": "true", "SystemModstamp": "2014-03-07T05:18:18.000Z", "CreatedDate": "2014-03-07T05:18:18.000Z", "AccountId": "", "Id": "5009000000JXKu7AAH", "Subject": "Power generation below stated level"}]';         
            
    }   
   
    public void buttonCode()
    {
      //
    }
             
   
}

If " fetchArchivedCasesCallout() " is un commented from the constructor it directly calls the custom component. but i dnt want to call it directly .
I want to call it through the command button

I have a requirement where i need to get the date from the datepicker field and convert that into standart GMT format (yyyy-MM-ddTHH:mm:ss.SSSZ).

how do I get the value of the selected date from the datepicker field?
below is my code .

VF Page :
-----------
<apex:page controller="datePicker1" id="mypage">
    <apex:form >  
        Date: <apex:inputText value="{!datename}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);" />  
        <apex:commandButton action="{!displayDate}" value="dispdate" />
        {!outputdate}
    </apex:form>
</apex:page>

APEX Code :
-------------------------

public class datePicker1
{

    public String outputdate { get; set; }
     public datetime datename {get; set;}
    
     public void displayDate()
     {
        
         String formattedDate = datename.format('yyyy-mm-dd');
         outputdate = formattedDate;
        
    }
}

This code is not displaying any thing please help to get the converted date.