You need to sign in to do that
Don't have an account?
Render VF Page based on Record Types
I have a custom object with 4 record types.Each RT has a custom VF page and I want to replace the standard "View" so that each record type displays it's respective VF page.
I was using a formula based, page include methid (pasted below) which was working but I changed something and can't seem to fix it. It now renders the same VF page for both RT's.
<apex:page standardController="Sales_Tool__c"> <apex:outputPanel rendered="{!IF(Sales_Tool__c.RecordTypeId!='012S00000004SX5',true,false)}"> <apex:include pageName="Assessment_Form" /> </apex:outputPanel> <apex:outputPanel rendered="{!IF(Job_Aid__c.RecordTypeId!='012S00000004SX0',true,false)}"> <apex:include pageName="CompellingEvent_Form" /> </apex:outputPanel> </apex:page>
Can someone please help me figure what's wrong this?I have a deadline to deploy this so any help would be appreciated.
If you're wondering why I'm not using all apex class/page sample from the cookbook, the reason is I've inherited an sfdc environment where there poor test coverage for existing code and until that's fixed,I cant do anything new.
Apex page action may be the answer, I did toy around with that but I'm not too familiar with VF and couldn't quite get that to work.
Thanks
Hi
Try using a 18 digit id for the RecordTypeId in the same code [I have marked the last three characters with "*"]
You can check out here in http://forceguru.blogspot.com/2010/12/how-salesforce-18-digit-id-is.htm or you can try in system log by trying this:
List<RecordType> rt = [select id from RecordType where id = 'the 15-digit id that you have in hand'];
system.debug(rt); // you can get the 18-digit id here.
All Answers
Hi
Try using a 18 digit id for the RecordTypeId in the same code [I have marked the last three characters with "*"]
You can check out here in http://forceguru.blogspot.com/2010/12/how-salesforce-18-digit-id-is.htm or you can try in system log by trying this:
List<RecordType> rt = [select id from RecordType where id = 'the 15-digit id that you have in hand'];
system.debug(rt); // you can get the 18-digit id here.
In rendered attribute of outputPanel, you are checking with two different Field/Object Names, may be that can be the issue.
Hope it helps.
That was it! The 18 digit record type id worked. Thank so much.
Hi I have an requirement where I am stuck. I want to display values of a picklist based on record type in Visual Force Page.
I have an Scontrol which directs the User to the VF page after he selects the record type and clicks on continue button. However I find all the values present in the picklist is displayed to the user , picklist value is not getting filtered based on the record type he select.
Scontrol which over-rides New Button is
<script type="text/javascript" src="/static/013008/js/functions.js"></script><script type='text/javascript' src='/soap/ajax/13.0/connection.js'></script><script src="/soap/ajax/13.0/apex.js" type="text/javascript"></script> <script src="/dJS/en/1213010380000/library.js" type="text/javascript"></script><script type="text/javascript"
src="/static/013008/desktop/desktopAjax.js"></script><script type='text/javascript'>
if('{!$Profile.Name}'=='RE_Austria _FieldSales_User' || '{!$Profile.Name}'=='REAustria_BUM_Profile' || '{!$Profile.Name}'=='REAustria_Product_Manager' || '{!$Profile.Name}'=='REAustria_Sales_Manager' ||'{!$Profile.Name}'=='System Administrator')
{
window.parent.location.href='/apex/Sample_New_Related_List?ent={!BXEU_Samples__c.Id }&RecordType={!BXEU_Samples__c.RecordTypeId}';}
else
{
window.parent.location.href=window.parent.location.href+'&nooverride=0';
}
</script>
Ane help would be appreciated.
Whats the error which you are getting?
Hi bindu,
I have a requirement, In that i need to display record types in vf page just like standard page. When i select record type then associated page should be displayed.
Thanks in Advance...