+ Start a Discussion
Armoury05Armoury05 

LEX - List View Button to create a record with few default values

Hello - I am looking for an approach to create a List View button in LEX where once it is clicked it will create a record in the bacground with few fields auto-populated and open up the detail page of this record.
Ex., In the below screenshot - currently the 'New' button on the 'Case' page opens up a popup to select the record type and then in the next page displays fields to manually enter the value and once it is saved it opens up the detail page. We would like to automate this process by displaying another button something called 'Quick New' then in the background creates a record with recordtype and few other fields like Origin, description etc., and then opens up the detail record of it. 
Any suggestions on this please.

User-added image

 
Etienne DKEtienne DK

My first suggestion is to have Flow create the new record and pre-populate it or use process builder to pre-populate.
To place the user on the newly created record page use the Local Actions released in Summer 18
(see https://developer.salesforce.com/blogs/2018/05/summer18-flow-local-actions-improved-debugger-and-more.html)

There are various options for starting the flow, eg have a url button (Object>Buttons, Link Actions) link to your flow.  Flows can be invoked by their url eg  /flow/quickNewFlow
Lightning App Builder makes it easy to drop the flow on a page, just drag n drop the flow component, specify the flow, save 'n go.

Another option would be a simple Global Action, perhaps combined with process builder.  The issue with this is I'm not sure how to place the user on the newly created record page once the record is created.  In mitigation, the system will show a success Toast with a link to the record for a few seconds, so the user could click into the record before it dismisses.

For a quick look at how to create an Account record with flow take a look at step 3 here:
https://trailhead.salesforce.com/trails/automate_business_processes/modules/business_process_automation/units/flow