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
Harshala P ShewaleHarshala P Shewale 

Related List custom list view button to create new record in lightning vs classic

Hello,

The customer has moved few Users in Lightning UI and however few users are still in classic.

On the Case object, there is opportunity related list with a custom list button in a classic with URL hack to create a child Opportunity record with default field population.

They want the same experience in lightning-like that button should open a lightning new record page with default field population. 

Challenge is a classic URL hack format does not work in lightning. They do not want 2 buttons on a related list one for classic and the other for lightning.

I am thinking of VF page approach, let me know if anyone has a sample code to start with, as I am not sure if the current record id will be of Case or Opportunity.

Else suggest a better approach.

Thanks,
Harshala
AbhishekAbhishek (Salesforce Developers) 
The old URL Hacks the only function in Salesforce Classic and had to be replaced by Custom Actions when you transitioned to the Lightning Experience. ... You won't be able to use these buttons inside of a Community or in the Salesforce Mobile App. They also won't work with Lightning Out.

As a workaround, you can try the code snippet as mentioned below,

https://thewizardnews.com/2020/01/27/url-hacks-are-back-and-in-lightning-with-spring-20/

For further reference, you can check this too,

https://www.forcetalks.com/blog/salesforce-url-hacking-for-lightning-experience/


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.