You need to sign in to do that
Don't have an account?
Matt Johnson 23
Custom Apex Buttom from Classic Not Working in Lightning
We have some custom buttons on the Opportunity Object that work in Classic but do not working in Lightning. The buttons allow our development staff to open an Opportunity from the Contact page and some information like Opportunity Name, Account Name and Primary Contact are prefilled. This works in Classic but with the switch to Lightning those three fields do not get autopopulated when the button is used. I will also share screenshots for what the coding is for the custom and standard buttons.
Can someone tell me how to replicate this behavior in Lightning?
See the screenshots of the custom "New Contact Donation (501)" button and the standard/native "New Contact Donation (Managed). One other thing that I've noticed is that when I switch to Classic and try out the buttons the custom button fills out the Opportunity Name, Account Name and Primary Contact fields on the new Opportunity but the standard/native only fills out the Opportunity Name and Account Name... doing nothing with the Primary Contact field.
Thank you very much,
Can someone tell me how to replicate this behavior in Lightning?
See the screenshots of the custom "New Contact Donation (501)" button and the standard/native "New Contact Donation (Managed). One other thing that I've noticed is that when I switch to Classic and try out the buttons the custom button fills out the Opportunity Name, Account Name and Primary Contact fields on the new Opportunity but the standard/native only fills out the Opportunity Name and Account Name... doing nothing with the Primary Contact field.
Thank you very much,
All Answers
The above buttons use URL hacking to autopopulate the fields which is not supported in Lightning Experience.
Have a look at this web page that may help you or give you some information regarding your concern.
https://www.linkedin.com/pulse/salesforce-lightning-url-hacking-alternatives-keith-mcrae
Opportunity Name
Account Name
Primary Contact
I don't know the correct way to create these fields so that as someone uses this Quick Action button that creates a new Oppotunity these three fields fill out correctly.
The Opportunity Name would be, however the Predefined Field Values do not allow me to use this setting:
{!Account.Name} - {!RecordType.Name}
The Account Name would be the name of the associated Account from which this Opportunity is being created from
The Primary Contact would be the Primary Contact on the Contact record from which this new Opportunity is being created via this New Membership - Quick Action.
Thank you for helping me understand how these Quick Actions are built. I read the supporting SF documentation but it's all pretty basic without any detailed information about how to actually get New Records to populate with this information.
but if you want the record type to be dynamic then I suggest creating an Aura Component and adding it to the Quick action (New Action -> Action Type = Lightning Component). In that way you will have the flexibility to dynamically prepopulate the fields. Also by using an Aura component you will be able to overcome limitation of Create Record quick action which does not allow to use all the fields on the layout.
Reffer the following if you opt to use the Aura component.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/data_service_create_record.htm
If it is then kindly mark it as solved so that it may help others in future.
Thanks and Regards