You need to sign in to do that
Don't have an account?
Ananthanarayanan Nemmara
Visualforce page fetching orders
Hi All,
I am new to the salesforce development world.I want to fetch few columns feilds from opportunity table and display it in account page related to the account. I realized that I would need to make a visualforce page for this and wrote the below code. I am working on salesforce lightning and cannot see the vf page to be added to my account page layout. Both the apex class and VF page are saved without error but cannot see the VF page in my VF page to add in page layout.
Please let me know if something is wrong:
Apex class:
public class RelatedOrdersController
{
public List<Opportunity> oppList1 { get; set; }
public static List<Opportunity> getOpen1(List<Opportunity> count)
{
id recId = Apexpages.currentpage().getparameters().get('id');
Integer lim = count.size() + 25;
List<Opportunity> oppList1 = [SELECT Order_Number__c FROM Opportunity WHERE RecordTypeId =: '012f40000005QP8' AND AccountId =: recId ORDER BY Order_Date__c DESC Limit :lim];
return oppList1;
}
}
VF page:
<apex:page controller="RelatedOrdersController">
<apex:pageBlock >
<apex:pageblockTable value="{!oppList1}" var="cl">
<apex:column value="{!cl.Order_Number__c}"/>
<apex:column value="{!cl.Order_Invoice_Type__c}"/>
<apex:column value="{!cl.Type}"/> </apex:pageblockTable>
</apex:pageBlock>
</apex:page>
I am new to the salesforce development world.I want to fetch few columns feilds from opportunity table and display it in account page related to the account. I realized that I would need to make a visualforce page for this and wrote the below code. I am working on salesforce lightning and cannot see the vf page to be added to my account page layout. Both the apex class and VF page are saved without error but cannot see the VF page in my VF page to add in page layout.
Please let me know if something is wrong:
Apex class:
public class RelatedOrdersController
{
public List<Opportunity> oppList1 { get; set; }
public static List<Opportunity> getOpen1(List<Opportunity> count)
{
id recId = Apexpages.currentpage().getparameters().get('id');
Integer lim = count.size() + 25;
List<Opportunity> oppList1 = [SELECT Order_Number__c FROM Opportunity WHERE RecordTypeId =: '012f40000005QP8' AND AccountId =: recId ORDER BY Order_Date__c DESC Limit :lim];
return oppList1;
}
}
VF page:
<apex:page controller="RelatedOrdersController">
<apex:pageBlock >
<apex:pageblockTable value="{!oppList1}" var="cl">
<apex:column value="{!cl.Order_Number__c}"/>
<apex:column value="{!cl.Order_Invoice_Type__c}"/>
<apex:column value="{!cl.Type}"/> </apex:pageblockTable>
</apex:pageBlock>
</apex:page>
Go to the visual force page and check the checkbox "Available for Lightning Experience, Lightning Communities, and the mobile app " to show on lightning .
Thanks for your response. I tried using the sample code that you provided but could you please let me know what is in the value field of apex:pageblockTable. I want to display opportunity feilds on account page.
Regards