You need to sign in to do that
Don't have an account?
srikanth sfdc
Getting contacts and opportunities based on account using visualforce
Hi Guys,
we have a account,contact,opportunity tab as standard object in salesforcce
so my requirement is that
i created a visualforce page
as i have a inputfield with accountname as lookup for that input field to select any account from lookup
and i have a button side of it as "get details"
as i enter an account into the input filed using lookup and press "get details" button i need to get who are all contacts and opportunities available in that account
can any one help me out of this
Thanks in advance
we have a account,contact,opportunity tab as standard object in salesforcce
so my requirement is that
i created a visualforce page
as i have a inputfield with accountname as lookup for that input field to select any account from lookup
and i have a button side of it as "get details"
as i enter an account into the input filed using lookup and press "get details" button i need to get who are all contacts and opportunities available in that account
can any one help me out of this
Thanks in advance
This code retrive contact information for seleced account similer you can get opportunities for selected account and then you can use it.
//Page
<apex:page controller="contactController">
<apex:form >
<apex:pageBlock title="My Content">
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:pageBlockSectionItem>
<apex:panelGroup>
<apex:outputLabel value="Lookup to an Account" for="theLookup"/>
<apex:inputField id="theLookup" value="{!cont.Accountid}"/>
<apex:commandButton value="get details" action="{!retriveDetail}"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
//Controller
public class contactController
{
public Contact cont{get; set;}
public contactController()
{
cont=new Contact();
}
public void retriveDetail()
{
List<Account> accinformation=[select id, (select id, name from contacts), name from Account where id = :cont.AccountId];
System.debug('************'+accinformation[0].contacts);
}
}