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
test batchtest batch 

Why record type name is not able to display in vf page

public ShowallTimeCatdsCtrl2(ApexPages.StandardController controller) {
        string invoiceid = ApexPages.currentPage().getParameters().get('id') ;
       
        system.debug('emailinvoice' + EmailInvoice);
        selectedtimecards = new List<Wrapclass>();
        selectedtimecards1 = new List<Wrapclass>();
        diselectedtimecards = new List<Wrapclass>();
        selectedtimecardsWrpr = new List<TimeCardWrapClass> ();
        mainPageWrap = new List<MainWrap>();
        wrap = new Map<string, List<Wrapclass>>();
        wrap1 = new List<Wrapclass>();
        empAmount = new map<string,decimal> ();
        clpAggList = new List<AggregateResult>();
        totalbool = true;
        tc = new Timecard__c();
        //invoiceId= new List<Id>();
        timeCardIds = new Set<Id>();
        payments = 0.00;
        downlodPdf = false;
        defalval = true;
        defalttotalbool = false;
        isEmptyEmail = false; //JS
        if(String.isNotBlank(invoiceid)) {
            objInvoices = [ SELECT  Id,
                           Name,
                           Account__c,Account__r.Accounts_Payable_Email__c,
                           Amount__c,
                           Check_No__c,
                           Comments__c,
                           Cross_Checked_Approved__c,
                           Date_Paid__c,
                           Due_Date__c,
                           Ext_Id__c,
                           Payment_Mode__c,
                           RecordType.Name,
                           Project__c,
                           Service_Term_From__c,
                           Service_Term_To__c,
                           Status__c,
                           Sub_Contractor_Employee__c,
                           Today__c
                           FROM    Invoice__c
                           WHERE   Id = :invoiceid];
            acdate = objInvoices.Service_Term_From__c; 
            dcdate = objInvoices.Service_Term_To__c;
        } else {
            objInvoices = new Invoice__c();
        }
        mailString=objInvoices.Account__r.Accounts_Payable_Email__c;//list of account mail ids.
        recordTypeId = ApexPages.currentPage().getParameters().get('RecordType');
        
        try {
            recordTypename = [  SELECT  id,
                              name
                              FROM    RecordType
                              WHERE   SobjectType ='Invoice__c'
                              AND Id = :recordTypeId
                              LIMIT   1 ].name;
        } catch(Exception e) {
            System.debug('Exception occurred while querying for RecordType : ' + e.getMessage());
        }
        
        
    }
    
    ========================vf================

 <apex:outputText value="{!callfunc}" escape="false"></apex:outputText>
        <apex:actionFunction name="calculateData" action="{!calculateData}" reRender="rrp,otpl,gtp1,txt,tpanl,messages"/>  
        <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId') " style="display:none;" />
        <apex:pageBlock title="Invoices" id="invoices">
            <apex:pageMessages id="messages"/>
            <apex:pageblocksection >           
                <apex:inputField value="{!objInvoices.Account__c}"/>    
                <apex:pageBlockSectionItem >
                    RecordType Name
                   <!--  <apex:outputText value="Auto Invoice"/>-->
                     <apex:outputText value="{!RecordtypeName}" style="color:red;font-weight: bold;"/>
                </apex:pageBlockSectionItem>
            </apex:pageblocksection>
            <apex:pageblockSection >
                <apex:inputField value="{!objInvoices.Status__c}"/>    
            </apex:pageblockSection>
            
            <apex:pageblockSection >
                <apex:inputField value="{!objInvoices.Cross_Checked_Approved__c}"/>
                <apex:inputField value="{!objInvoices.Project__c}"/> 
            </apex:pageblockSection>
            
            <apex:pageblockSection >
                <apex:inputField value="{!objInvoices.Service_Term_From__c}"/>  
            </apex:pageblockSection>

 
Akhil AnilAkhil Anil
Write a getter setter for the RecordTypeName variable in your class like this


public String RecordtypeName {get;set;}

That should work !

Kindly mark it as an answer if that resolves your query.
 
test batchtest batch

Thanks Akhil,

But Why   <apex:outputText value="{!objectinvoices.Recordtype.Name}" style="color:red;font-weight: bold;"/> is not working.?

test batchtest batch
it is rendering only on edit page, not on detail page. @ akhil