Is there a way to use the sforce.one.createRecord to create an Opportunity and fill in fields with data? In Salesforce Classic this was accomplished by adding parameters to the url (ex: ?name=foo).
Has Salesforce given a way to do this in Lightning?
URL hacks are not supported in Lightning Experience. The best way to prepopulate fields in Lightning Experience is to use actions.
- on the Account object I created an action to create a new opportunity and prepopulate some fields by going to: Setup -> Object Manager -> Account -> Buttons, Links, and Actions -> New Action.
- Next add whatever fields you would like to have on the layout that will popup up in LEx when the button is clicked.
- Then add each predefined field and the default values.
- Finally add the button to the page layout in the Quick Actions section for Salesforce1 and Lightning Experience Actions.
The button will be available in the top right of the account and when clicked the page layout will popup with the defaults.