• Nagaraju Mogili
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 13
    Replies
Apex code

public class me {

   public list<Schema.Account> Acc {get;set;}
   
   
   public me (){
     list<Schema.Account> Acc = new list<Schema.Account>();
     Acc = [select id,name,phone from Account];
   }
}

VF code::

<apex:page controller="me" sidebar="false">
   <apex:form >
     
<apex:pageblock id="pb">
<apex:pageblocktable value="{!acc}" var="c">
<apex:column value="{!c.name}"/>
<apex:column value="{!c.phone}"/>
</apex:pageblocktable>


</apex:pageblock>
</apex:form>
</apex:page>
User-added image

Here is My code....


<apex:page controller="NewController_cntrlr" sidebar="false" id="thepage" ShowHeader="false">
  <apex:form >
    <apex:pageBlock id="Thepage" title="Account Details">
       <apex:pageBlockSection collapsible="true">
          <apex:inputField value="{!acc.name}"/>
          <apex:inputField value="{!acc.rating}"/>
          <apex:inputField value="{!acc.AnnualRevenue}"/>
          <apex:inputField value="{!acc.Fax}"/>
          <apex:inputField value="{!acc.Industry}"/>
      </apex:pageBlockSection> 
        <apex:pageBlockSection >
            <apex:pageBlock title="Opportunities Information">
                <apex:pageBlockTable value="{!opplist}" var="x" columns="1">
                   <apex:column headerValue="Name">
                       <apex:inputText value="{!x.Name}"/>
                   </apex:column> <br/>  <br/>
                    <apex:column footerValue="stagename">
                       <apex:inputText value="{!x.StageName}"/>
                   </apex:column> 
                   <apex:column headerValue="CloseDate">
                       <apex:inputText value="{!x.CloseDate}"/>
                   </apex:column> 
                   <apex:column >
                       <apex:commandButton action="{!AddRow}" value="Addrow"/>
                   </apex:column>  
                   <apex:column >
                       <apex:commandButton action="{!DelRow}" value="Delrow"/>
                   </apex:column>   
                   <apex:column >
                       <apex:commandButton action="{!Edit}" value="Edit"/>
                   </apex:column>
                   <apex:column >
                       <apex:commandButton action="{!remove}" value="Remove"/>
                   </apex:column> 
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:pageBlockSection>
    </apex:pageBlock>

  </apex:form>
</apex:page>
 
User-added image

I have displayed the Account object records and Edit and Delete buttons on the Visualforce Page, can anyone please let me know how can i Edit and delete from the vf page.
I want to show the number of contacts of an Account in the vf page using Apex code and Vf page..
 
User-added image

I have displayed the Account object records and Edit and Delete buttons on the Visualforce Page, can anyone please let me know how can i Edit and delete from the vf page.
I want to show the number of contacts of an Account in the vf page using Apex code and Vf page..
 
trigger InvoiceSum on Invoice_Items__c (after insert, after update)
    {
     Set<Id> InvIds = new Set<Id>();   
     for(Invoice_Items__c ii :trigger.new)
     { InvIds.add(ii.InvoiceFK__c); }

        List<Invoice__c> InvRecs = [Select id, Ammount__c from Invoice__c where id in : InvIds ];
       
       for(Invoice__c inv : InvRecs)
        {
          //inv.Ammount__c= [Select sum(Invoice_items__r.Amount__c) from Invoice_Items__c ];
           Decimal total=0;
        //   for (Invoice_items__c iit: inc.Invoice_items__c)
          inv.Ammount__c =inv.Invoice_items__r.Amount__c;
            update inv;
        }
     
    }
Invoice__c is parent object and Invoice_item__c is child, I have to sum the all line items amount and display on Invoice__c record. Please help.
Populate Contacts in picklist based on selected .
If i select a picklist of Accountname--> all names will be displayed.
Then if i select a name  "conatcts" of that names must be displayed in a new picklist .

    public with sharing class AccountController1 {
    public String selectedAccId{get;set;}
          
           public List<SelectOption> getAccountNames() {
                  List<SelectOption> accOptions= new List<SelectOption>();
                  accOptions.add( new SelectOption('','--Select--'));
                  for( Account acc : [select Id,name from Account ] ) {
                          accOptions.add( new SelectOption(acc.Id,acc.name)); /*SelectOption list takes two parameters one is value and other one is label .In this case account name as a label and Id is the value .*/
                  }
                 return accOptions;
           }
    }
   
   
   
   
    <apex:page controller="AccountController1">
              <apex:form >
                       <apex:pageBlock title="Account Name">
                               Account Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                   <apex:selectList value="{!selectedAccId}" size="1">
                                               <apex:selectOptions value="{!AccountNames}" />
                                   </apex:selectList>
                      </apex:pageBlock>
            </apex:form>
    </apex:page>




Hi i am able to display the records of account name picklist, But if i select a picklist name its related contacts records must be displayed in a new picklist
  • February 25, 2014
  • Like
  • 1