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
VarunCVarunC 

Unable to pass Custom Parameters to a Visualforce Page via URL custom button in Lightning Experience

I've a Custom Object whose NEW and EDIT Standard Buttons/Links have been overridden with a Visualforce Page.

This Custom Object also has couple of Record Types on it.

I've added a Custom URL Button for each RecordType so as to quickly execute the override VF page by skipping the Record Type selection page.

Now, this works fine in Classic, and it has worked fine in Lightning Experience till now. But now, I've noticed that the URL Button is not passing the custom parameters, which I've set in URL Button.

My URL Button code is this:
{!URLFOR('/'+ $ObjectType.Custom_OBject_A__c +'/e' , null, [RecordType=URLENCODE('01290000000c821'), parentid=Parent_Object__c.Id], false)}



And this button has been created on Custom_Object_A__c.

So when this button is called from the Custom Object A's related list on Parent Object Detail View, the Visualforce Page set on the EDIT link as override opens and with custom Apex controller code, I read the parentid querystring parameter and populate the target field in the vf page.

This parentid parameter is getting passed in Classic but not in Lightning Experience.
Alba RivasAlba Rivas
Apparently there is a problem passing RecordTypes when using URLFOR in Lightning.

In this post there is a solution. Although I don't think it is robust, it seems to work: https://developer.salesforce.com/forums/?id=906F00000008kdbIAA

Regards