You need to sign in to do that
Don't have an account?
NewBee21
My requirement is I want the contacts of the Account which I search with the look up (see screenshot) and then I will get contacts related to the account to me.
My requirement is I want the contacts of the Account which I search with the look up (see screenshot) and then I will get contacts related to the account to me.
heres what i achieved till the lookup part,but now stuck with how do i get contacts fetched to me of the account.
**controller**
public class freshcontroller1
{
public contact con {get;set;}
Account ac;
public freshcontroller1(ApexPages.Standardcontroller controller)
{
con =new contact();
}
public Account getAc()
{
return ac;
}
public pagereference showcontact()
{
ac = [select id from Account where id=:con.accountid];
System.debug('Ac '+ac);
return null;
}
public pagereference Contact()
{
con=[select id,Name,Phone from Contact where id=:con.accountid];
System.debug('contacts are '+con);
return null;
}
}
*VF Page**
<apex:page standardController="Account" extensions="freshcontroller1">
<apex:form > <apex:pageBlock title="Account information"/>
<apex:inputField value="{!con.accountid}"/>
<apex:commandButton action="{!showcontact}" value="Display contacts"/>
<apex:pageBlock > <apex:pageBlockTable value="{!con}" var="c"/>
</apex:pageBlock>
</apex:form>
</apex:page>
heres what i achieved till the lookup part,but now stuck with how do i get contacts fetched to me of the account.
**controller**
public class freshcontroller1
{
public contact con {get;set;}
Account ac;
public freshcontroller1(ApexPages.Standardcontroller controller)
{
con =new contact();
}
public Account getAc()
{
return ac;
}
public pagereference showcontact()
{
ac = [select id from Account where id=:con.accountid];
System.debug('Ac '+ac);
return null;
}
public pagereference Contact()
{
con=[select id,Name,Phone from Contact where id=:con.accountid];
System.debug('contacts are '+con);
return null;
}
}
*VF Page**
<apex:page standardController="Account" extensions="freshcontroller1">
<apex:form > <apex:pageBlock title="Account information"/>
<apex:inputField value="{!con.accountid}"/>
<apex:commandButton action="{!showcontact}" value="Display contacts"/>
<apex:pageBlock > <apex:pageBlockTable value="{!con}" var="c"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Try Below Code Please Mark It As Best Answer If it Helps
Thank you!