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
UrvikUrvik 

Passing Record ID to VFP URL

Hi,
I have been trying to pass a record ID to the URL. I have four record types and based on the record type, the edit button is overridden but not able to pass the record id. it gives me error.. see my vfp below.. So if the Record Type if TER Form then if the user clicks EDIT, it should pick up TER Visualforce page and populate fields from the record..Please help..

<apex:page standardController="Project_Governance_Form__c" action="{!URLFOR(CASE(Project__c.RecordType.Name, 'TER Form', '/apex/Form_Edit_Override_TER?id={!Project__c.Id}'))}" >
    <apex:variable value="{!Project__c.RecordType.Name}" var="recTypeName"/>
</apex:page>


James LoghryJames Loghry
Does your URLFOR method work with the exception of the RecordType.Name parameter?  

You're going to have to requery in either a controller or extension if you need to fetch the name.  Otherwise, RecordTypeId is available if you can use that instead.

Also, if you're looking for URLFOR tips and tricks, I usually come back to this blog over and over again: http://salesforcesource.blogspot.com/2008/12/urlfor-function-finally-explained.html
UrvikUrvik
Hi James,
The URLFOR method works with RecordType.Name if I don't pass the record id in it...But I have to pass the record id to make it work properly. Am I doing anything wrong in passing the record it to URL?

Thanks