You need to sign in to do that
Don't have an account?
imishra
Render fields based on parent field(Urgent)
Hi,
I have a lookup relationship between Account and Qualification.
For Qualification i have visualforce page.
When i click on "New Qualification", it should check the picklist value for a field in account i.e. Vertical=Technology.
If it is true a set of fields should be displayed and if it is false another set of fields should be displayed in Qualification page.
Is it possible to do this?
If yes please let me know and provide a sample code for this.
Thanks.
I have a lookup relationship between Account and Qualification.
For Qualification i have visualforce page.
When i click on "New Qualification", it should check the picklist value for a field in account i.e. Vertical=Technology.
If it is true a set of fields should be displayed and if it is false another set of fields should be displayed in Qualification page.
Is it possible to do this?
If yes please let me know and provide a sample code for this.
Thanks.
You can do this by using pagepblocksection with Rendered so you can render pageblocksection based on rendered condition.
eg:
<apex:pageBlockSection rendered="{!test== true}" columns="2" id="testID">
<apex:pageBlockSection rendered="{!test== false}" columns="2" id="testIDone">
So, in controller you need to check the condition assign value of test so for true testID will work for false testIDone will work
Thanks.
I have written the below code:
<apex:page standardController="Qualification__c" extensions="NewQualification">
<apex:form >
<apex:pageBlock title="Qualification Edit">
<apex:pageBlockSection title="Quantitative Metrics" columns="2" rendered="{!redirectToPage== true}" id="testID">
<apex:inputField value="{!Qualification__c.Prospects_Annual_Revenue_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula1__c}"/>
<apex:inputField value="{!Qualification__c.Prospect_s_Estimated_Annual_Spend_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula2__c}"/>
<apex:inputField value="{!Qualification__c.Most_Likely_first_year_revenue_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula3__c}"/>
<apex:inputField value="{!Qualification__c.Most_Likely_second_year_revenue_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula4__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Quantitative Metrics" columns="2" rendered="{!redirectToPage== false}" id="testIDone">
<apex:inputField value="{!Qualification__c.Prospects_Annual_Revenue_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula5__c}"/>
<apex:inputField value="{!Qualification__c.Prospect_s_Estimated_Annual_Spend_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula6__c}"/>
<apex:inputField value="{!Qualification__c.Most_Likely_first_year_revenue_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula7__c}"/>
<apex:inputField value="{!Qualification__c.Most_Likely_second_year_revenue_in_US__c}"/>
<apex:inputField value="{!Qualification__c.Formula8__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Class:-
public class NewQualification {
ApexPages.standardController stdctrl = null;
public NewQualification(ApexPages.StandardController sc){
stdctrl = sc;
}
public PageReference redirectToPage() {
Account acc = [Select id, name, Vertical__c from Account where id = : ApexPages.currentPage().getParameters().get('id')];
if (acc.Vertical__c == 'Technology')
return Page.Qualification.setRedirect(true);
else
return null;
}
}
While saving i get the belwo error:
Error: Unknown property 'Qualification__cStandardController.redirectToPage'
Can you please let me know where i am going wrong.