+ Start a Discussion
Max Michael Ingraham-RakatanskyMax Michael Ingraham-Rakatansky 

Visualforce Page - Restrict Child Record Types option based on Parent Record Type


We have a custom button in our Salesforce environment that links to a Visualforce page for creating a new related custom object record. I am looking for a way to restrict the record type options of the child object based on the parent object's record type. While I am not the one who designed the code, I have some basic understanding of Visualforce and Apex, and have made some modifications to our org's code in the past. 

Do you know the best way to go about this? Would this change be reflected in Visualforce or Apex?

VF Page
<apex:page name="Confirm Investigation" standardcontroller="case" extensions="CasetoAccountContactDDQ">
<style type="text/css">
    .pbTitle {
        white-space: nowrap;
    function goCancel(){
<apex:form >
 <apex:pageMessages />
<apex:pageBlock title="Select DDQ Type" id="mainBlock">
       <apex:pageBlockButtons location="Bottom">
             <apex:commandButton value="Cancel" onclick="goCancel();return false;"/>  
            <apex:commandButton value="Send DDQ" action="{!createObjs}"   />      
   <!--<apex:outputText value="{!newcase.AccountId}" style="font-size:11px;font-weight:bold;color:blue" />--->
       <apex:outputPanel >
           <apex:pageBlockSection columns="2">
               <apex:inputField value="{!dueDateCase.DDQ_Due_Date__c}"/>
       <apex:outputPanel >
           <Strong>DDQ Type&nbsp;&nbsp;:&nbsp;&nbsp;</strong>
                      <apex:selectList value="{!selectedDDQType}" size="1" required="true">
               <apex:selectOptions value="{!DDQRecordTYpesSelect}"/>
<h2>Available DDQ Types</h2>
<table style="font-size:15px;border: 1px solid hsl(252, 4%, 26%) !important;">
<tr><th style="background:e0e3e5;border-right:1px solid hsl(252, 4%, 26%) !important;border-bottom:1px solid hsl(252, 4%, 26%) !important;">&nbsp;&nbsp;<Strong style="font-weight: bold !important;">Name</strong></th><th style="background:e0e3e5;border-bottom:1px solid hsl(252, 4%, 26%) !important;">&nbsp;&nbsp;<strong style="font-weight: bold !important;">Description</strong></th></tr>
<apex:repeat value="{!recordTypeList}" var="rt">
    <tr><td style="border-right:1px solid hsl(252, 4%, 26%) !important;border-bottom:1px solid hsl(252, 4%, 26%) !important;">&nbsp;&nbsp;{!rt.name}&nbsp;&nbsp;</td><td style="border-bottom:1px solid hsl(252, 4%, 26%) !important;">&nbsp;&nbsp;{!rt.description}&nbsp;&nbsp;</td></tr>

        background: #f2f3f3;
        color: #000;
        font-size: .15em;
        font-weight: bold;
        border-bottom: 1px solid #e0e3e5;