You need to sign in to do that
Don't have an account?

How to redirect to multiple VF pages according to record type ID?
I figure it out when I click on the PB-005426 ({!p.Id}), to redirect to a new VF page layout (gibco2) with all vlues. But I have 5 different record type and VF pages. When user click on product brief number ({!p.Id}), I want to direct them to the right page. For Ex.
Record Type (RecordTypeId) = Media and Buffers then direct them to ('/apex/gibcopb2')
Record Type (RecordTypeId) = Hardware - S.U.B.then direct them to ('/apex/sum1')
Record Type (RecordTypeId) = BPC then direct them to ('/apex/page1')
In below code it only goes to one page('/apex/gibco2). I search for a example and could not find anything suitable for me. Most of them are confusing, and any idea how to assign multiple page according record type ID? Thanks.
<apex:page standardController="Product_Brief__c" extensions="DispatcherContactNewController"> </apex:pageBlock> </apex:form> <apex:pageBlock title="Recent Product Briefs"> <apex:pageBlockTable value="{!pbs}" var="p" > <apex:column > <apex:commandLink action="{! assetClicked}" value="{!P.Name}" id="theCommandLink"> <apex:param value="{!P.Id}" name="{!P.Id}" assignTo="{!selectedAsset}" ></apex:param> </apex:commandLink> </apex:column> <apex:column value="{!p.RecordTypeId}"/> </apex:pageBlockTable> </apex:pageBlock </apex:form> </apex:pageBlock>
Extension
public class DispatcherContactNewController { public DispatcherContactNewController(ApexPages.StandardController controller) { this.controller = controller; } public ApexPages.StandardSetController setpb{ get{ if(setpb == null){ setpb = new ApexPages.StandardSetController(Database.getQueryLocator( [SELECT Id, Name, RecordTypeId, Createddate FROM Product_Brief__c ORDER BY Createddate DESC ])); setpb.setPageSize(10); } return setpb; } set; } public List<Product_Brief__c>getpbs(){ return (List<Product_Brief__c>)setpb.getrecords(); } /* ---------- For Redirect to New Page ------ */ public string selectedAsset {get;set;} public PageReference assetClicked() { PageReference redirect = new PageReference('/apex/gibcopb2'); // pass the selected asset ID to the new page redirect.getParameters().put('id',selectedAsset); redirect.setRedirect(true); return redirect; } }
Please let us know if this will help you.
Thanks
Amit Chaudhary
All Answers
Please let us know if this will help you.
Thanks
Amit Chaudhary