I have a requirement to show different edit layout, based on recordtype, using standard edit button override. I’m trying to create a visualforce page and assign it to the edit button, refrering this question . here what i’ve tried so far :
<apex:page standardController="Abv_Core_KAM_Engagement_Plan__c" action="{!URLFOR(CASE(Abv_Core_KAM_Engagement_Plan__c.RecordType.Name, 'Abv_Core_KAM_Engagement_Plan', '$Action.Abv_Core_KAM_Engagement_Plan__c.Edit,Id' ,'Abv_Core_KAM_Strategic_Initiative','$Action.Abv_Core_KAM_Engagement_Plan__c.Edit,Id','$Action.Abv_Core_KAM_Engagement_Plan__c.Edit,Id'))}" > <apex:variable value="{!Abv_Core_KAM_Engagement_Plan__c.RecordType.Name}" var="recTypeName"/>
which errors out
Error: Field $Action.Abv_Core_KAM_Engagement_Plan__c.Edit,Id does not exist. Check spelling.
please suggest any alternatives. thanks !
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
I think it’s the way that you’re attempting to nest inside that URLFOR. Try restructuring it so that the Id param is outside the CASE (since it’s gonna be the same no matter what), and also don’t use quotes around those $Action references. maybe like this (whitespaced for readability)
<apex:page standardController="Abv_Core_KAM_Engagement_Plan__c" action="{!URLFOR( CASE(Abv_Core_KAM_Engagement_Plan__c.RecordType.Name, 'Abv_Core_KAM_Engagement_Plan', $Action.Abv_Core_KAM_Engagement_Plan__c.Edit, 'Abv_Core_KAM_Strategic_Initiative', $Action.Abv_Core_KAM_Engagement_Plan__c.Edit, $Action.Abv_Core_KAM_Engagement_Plan__c.Edit ), Abv_Core_KAM_Engagement_Plan__c.Id) }" >
Although, I’m a bit confused because it looks like you’re sending it to the same place every time…
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0