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
Shubham SengarShubham Sengar 

Record type link with VF

How to connect vf with record type ..??

like ---- I have 2 record type in work order object ..
first one is -Change revision 
2nd is - Revision data 

when we select Change revision  it goes to vf and when we select 2nd  Revision data  its goes to standered page .
bob_buzzardbob_buzzard
You'll need to redirect all requests to the Visualforce page and then have a page action method that pulls the record type from the database and either redirects the user to the standard page or continues with the Visualforce page.

There's a sort of example here:

https://gist.github.com/jeromenirmal/6236370

although you'll need to query the record type rather than passing it on the URL.
Shubham SengarShubham Sengar
Hi Bob,

Thanks for your help  ..

I'm using vf page like ---- plz check n let me know where m doing worng or need to add code ..
my vf page is a search page where one additional button if our data is noy fund then a new Button comes to create new one ....



<apex:page StandardController="Work_Order__c" extensions="Search" showheader="true" action="{!redirect}">
<apex:form >
   
            <apex:outputLabel >Enter The Work Order Number ::- </apex:outputLabel>
            
            
            <apex:inputText value="{!searchText}"/><br/>
             
            <apex:commandButton value="Search" Action="{!Search}"/><br/>
             <apex:commandButton value="New" Action="{!createNew}" rendered="{!showNew}"/>
             
             
           
           
           
            <apex:pageBlock >
            <apex:pageBlockSection >
            <apex:outputText >Message: {!msg}</apex:outputText>
             </apex:pageBlockSection> 
           
           
          </apex:pageBlock>
</apex:form>  
</apex:page>
controller............
public class Search
{   
    public String SearchText{get;set;}
    public Work_Order__c wo{get;set;}
    public string msg{get;set;}
    public boolean showNew { get; set;}
 
    public Search(ApexPages.StandardController controller)
     {
        showNew = false;
     }
 
   public void search()
    {
        List<Work_Order__c> wolist=[select id,name from Work_Order__c];
        for(Work_Order__c w:wolist)
        {
            if(w.name.containsIgnorecase(searchText))
            wo=w;                  
        }
        if(wo==null)
       {
            msg='Work Order Number Not Exist u can create New by given link below';
             showNew = true;
                         
        }
        else
        {
            msg='Work Order Number already Exist' ;
           showNew = true;
        }
    }
  
   public PageReference createRecord() {
 
        PageReference createPage=new ApexPages.StandardController(Work_Order__c);
 
        createPage.setRedirect(true);
 
      return createPage;
 
}
 }