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
Tamara HayTamara Hay 

Pre Selecting a case record type

I have a link on my opportunity line item that users click to create a case for a specific team. Currently, the case record type creates as the default record type which is "Sales Support", however these need to override the default assignment rules and create a "Feasibility" case.
We had a developer create this who is no longer with us. There is a controller and visualforce page.
This is what I have:

Visualforce page:

<apex:page standardController="Case" extensions="FeasibilityRequestCaseController">
<script language="javascript">
   window.onload = new function() 
      // bring popup window to front
      var ele=document.getElementById('{!$Component.form.block.section.olilookupid}');
      if (ele)
      var ele1=winMain.document.getElementById('{!$CurrentPage.parameters.olilookupid}');
   function fillIn(addressField, olilookupid)
      var winMain=window.opener;
      if (null==winMain)
      var ele=winMain.document.getElementById('{!$CurrentPage.parameters.olilookupid}');

      var ele1=winMain.document.getElementById('{!$CurrentPage.parameters.olilookupid}');

   function CloseWindow()
      alert('Thanks for raising new case for feasibility request. Feasibilty analysis personnel will update available feasibility options for you shortly.');
      var winMain=window.opener;
      if (null==winMain)
<apex:pageBlock >
<apex:pageBlockSection title="Raise a New Case - Request Feasibility Analysis" columns="1" showHeader="True" collapsible="False">
<apex:form >
<apex:pageBlock title="Feasibility Request - Case Information" >
<apex:pageBlockButtons >
    <apex:commandButton action="{!save}" value="Submit for Feasibility Analysis" oncomplete="CloseWindow();"/>
    <apex:pageBlockSection >
    <apex:inputField value="{!frc.Subject}" style="width: 360px;"/>        
    <apex:inputField value="{!frc.Opportunity__c}"/>
    <apex:inputField value="{!frc.Reason}"/>
    <apex:inputField value="{!frc.Status}"/>
    <apex:inputField value="{!frc.Description}" style="width: 360px; height: 40px"/>
    <apex:inputField value="{!frc.Origin}"/>
    <!--<apex:inputField value="{!frc.RecordType.Name}"/>-->

public class FeasibilityRequestCaseController {
    public String oliID{get; set;}
    public String olilookupid{get; set;}
    public Case frc{get; set;}
    public String address{get; set;}
public FeasibilityRequestCaseController (ApexPages.StandardController controller) {
        String oliId = ApexPages.currentPage().getParameters().get('oliIDForNewCase');
        String olilookupid = ApexPages.currentPage().getParameters().get('olilookupid');
        String caseName = '';
        String caseAddress = '';
        opportunitylineitem oli;
        Id oppId;
        Id oppLIId;
        //oliId = '\'' + oliId + '\'';

        System.debug('FeasibilityRequestCaseController:: oliId - ' + oliId + ' :: olilookupid - ' + olilookupid);
        System.debug('Query:: Select id, name, Address_AEnd__c, OpportunityId from opportunitylineitem where id = ' + olilookupid);
        oli = [Select id, name, Address_AEnd__c, OpportunityId from opportunitylineitem where id = :olilookupid];
                caseName = oli.Name;
                caseAddress = oli.Address_AEnd__c;
                oppId = oli.OpportunityId;
                oppLIId = oli.Id;
        // RecordType recordType = [Select Id From RecordType  Where SobjectType = 'Case' and Name = 'NZ Feasibility'];
        frc = new Case();    
        frc.Subject='New Feasibility Request: ' + olilookupid;
        frc.Reason='Supplier quote request';
        frc.Description='Please provide feasibility for Address: ' + oliId;
        // frc.RecordType=recordType;
        //frc.Related_Product_del__C = oppLIId;
        if(oppId!=null) frc.Opportunity__c= oppId;

public pagereference Save()
        insert frc;
        Case c = [select Casenumber from Case where];
        system.debug('New Case Number: ' + c.Casenumber );
        return null;