0

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 !

  • Check your spelling. Comma? Plan__c.Edit,Id – Sergej Utko Jan 13 '15 at 11:04
  • Hi @ mast0r, using this syntax for redirect to that particular engagement_plan id edit page, like we use in outputlink : ` <apex:outputLink value="{!URLFOR($Action.Account.ChangeOwner, accountId)}">` – user59759 Jan 13 '15 at 11:15
2

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.