function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shyam Sundar 101shyam Sundar 101 

Help me on vf !!!

Hi,

I have a an object called payment_plan__c which is parent and child payment_detail__c is child.. I want to create a vf page in another object called Bookin__c which has a lookup (Payment_Plan__c) .Need to fetch child record(i.e) Payment_Details_c  Based on the lookup value in booking object on a button click in booking object

Thanks in advance,
Shyam.
Best Answer chosen by shyam Sundar 101
Dushyant SonwarDushyant Sonwar
<apex:pageBlockTable value="{!lstPaymentDetail}" var="paymentDetailObj">
	<apex:column headervalue="Payment Detail" >
		<apex:outputLink value="/{!paymentDetailObj.Id}"> {!paymentDetailObj.Name} </apex:outputLink>
	</apex:column>
</apex:pageBlockTable>
Sorry for the typo , try this one.
 

All Answers

Dushyant SonwarDushyant Sonwar
HI Shyam ,

As assuming the object and field schema , you can try using below .

As it is a rough code , there may be compilation error 
 
<apex:page standardController="Booking__c" extension="BookingEditController">
	<apex:form>
		<apex:pageBlock>
			<apex:pageBlockSection title="Payment Detail">
				<apex:pageBlockTable value="{!lstPaymentDetail}" var="paymentDetailObj">
					<apex:column value="{!paymentDetailObj.Name}" />				
				</apex:pageBlockTable>
			<apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>
 
public class BookingEditController{
	public Booking__c bookingObj{get;set;}
	
	public list<Payment_detail__c> lstPaymentDetail{get;set;}
	public BookingEditController(ApexPages.StandardController std){
		std.addFields(new list<String>{'Payment_Plan__c'});
		lstPaymentDetail = new list<Payment_detail__c>();
		
		bookingObj = (Booking__c) std.getRecord();
		if(bookingObj.Payment_Plan__c != null){
			lstPaymentDetail = [Select id,name from payment_Detail__c where payment_Plan__c = :bookingObj.Payment_Plan__c];
		}
	}
}

Hope this helps.
shyam Sundar 101shyam Sundar 101
Hi, Dushyanth

Actually the line 1 in VF 

<apex:page standardController="Booking__c" extension="BookingEditController">

displays error as ( Unsupported attribute extension in <apex:page> in Payment) kindly look.

Thanks,
Shyam
Dushyant SonwarDushyant Sonwar
Hey shyam ,

It was a typo error.
<apex:page standardController="Booking__c" extensions="BookingEditController">

Please check .

There may be other typo also.
Dushyant SonwarDushyant Sonwar
It will work fine , but i haven't compiled on editor , there may be typos
shyam Sundar 101shyam Sundar 101
Dushyanth,

It is working fine , I have cleared the rest of typo's but can we make it as an hyperlink so that on displaying payment details through VF can navigate to view individually???
Dushyant SonwarDushyant Sonwar
You can use apex:outputLink tag for this.
 
<apex:pageBlockTable value="{!lstPaymentDetail}" var="paymentDetailObj">
	<apex:column headervalue="Payment Detail" >
		<apex;outputLink value="/{!paymentDetailObj.Id}"> {!paymentDetailObj.Name} </apex:outputLink>
	</apex:column>
</apex:pageBlockTable>


 
Dushyant SonwarDushyant Sonwar
<apex:pageBlockTable value="{!lstPaymentDetail}" var="paymentDetailObj">
	<apex:column headervalue="Payment Detail" >
		<apex:outputLink value="/{!paymentDetailObj.Id}"> {!paymentDetailObj.Name} </apex:outputLink>
	</apex:column>
</apex:pageBlockTable>
Sorry for the typo , try this one.
 
This was selected as the best answer