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 

Custom Button has to navigate record edit page based on record type

Am haviing two vf pages, each page has assigned to separate record type, i created one custom button to navigate record edit page, here am getting error coz of for loop, guys please help me, where i went wrong.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
if({!Invoice__c.RecordTypeId} =='01250000000V8nG'){ 

alert("hi"); 

var refString = '/apex/ShowAllTimecards2?RecordType={!Invoice__c.RecordTypeId}&id={!Invoice__c.Id}'; 
window.location.href=refString; 
} 

else { 

var refString1 = '/apex/Semiinvoice?RecordType={!Invoice__c.RecordTypeId}&id={!Invoice__c.Id}'; 
window.location.href=refString1; 
}
gopi biswalgopi biswal
Can u specify where u r facing the error, Because there is no for loop in your code itself.. 
 
test batchtest batch
when am clicking the button.. it showing unexpected token