You need to sign in to do that
Don't have an account?
Override Standard New button with a Lightning Component and VF Page
I have a requirement to prepopulate some fields (Address Fields) when standard "New" button is clicked from the related list (Contact) of Account. This was being achieved using an intermediate VF page in classic.
Now in lightning, I am able to create a component with a quick action to achieve the same - but the problem here is that the override has to be either a vf page or a lightning component.
Is there any way to have both on a single button - like when in classic, follow the old approach by redirecting to an intermediate vf and prepopulating the values and when in lightning, use the newly created lightning component?
Now in lightning, I am able to create a component with a quick action to achieve the same - but the problem here is that the override has to be either a vf page or a lightning component.
Is there any way to have both on a single button - like when in classic, follow the old approach by redirecting to an intermediate vf and prepopulating the values and when in lightning, use the newly created lightning component?
Your component needs to implement lightning:actionOverride.please refer the below link for reference.
- https://success.salesforce.com/answers?id=9063A000000DoE9QAK
- https://salesforce.stackexchange.com/questions/173298/overriding-standard-buttons-with-lightning-components
hope it helps.Please mark it as best answer if the information is informative
Thanks
Rahul Kumar
That part is already done - not sure if my question is clear or not. I want a vf page when i click on "New" button in classic and a lightning component when in lightning exp. Both are needed and not one. I am able to do both of these individually, but I need it to work seamlessly. Hope you get my point!!!
Let me know in case any other info is needed from me!
Hi Siddharth, I am in similar situation but facing a different problem.
I am not able to get Account Id when I try to invoke lightning component using Overridden "New" Button from related list like Contact/Calls.
Were you able to get Account Id when using lightning component??
Thanks, Sriram
you cannot differentiate actions in the salesforce. You can either override with vfpage or lightning component.
In your scenario create a vfpage using themes and SLDS for the lightning side.
here is the small example for you
Theme3 is Classic
Theme4d is lightning.
Thanks
Pramodh.
Thanks for the suggestion. I did try out this approach, but the problem I faced was that I was unable to get the current record Id from where the button was being clicked when in lightning. Without getting the current record Id, it wont be possible to pre-populate fields which is ultimately the requirement. Hence went for a Quick action+component approach and removed the button from related list altogether.
Let me know if you are able to get the current record Id in lightning when you click a button from a related list?
If you found better way, please share.
implements="lightning:actionOverride,force:hasRecordId,force:hasSObjectName" By using that you can override that Standard Action.
You can Have a look on https://rajvakati.com/2018/02/18/lightning-components-actions-override/