Use Case: Replace “New” Button with Screen Flow
Currently we can only overwrite the New button using programmatic tools (ex. Visualforce, LWC), which is not admin-friendly at all. Luckily, besides overwriting, we can also create a new “New” button and replace the original one. All we need to do is to create a simple screen flow!
With the Fields and Section features, you can create a prettier, more flexible creation page that fits your needs better. Furthermore, this solution can even help you set up some naming convention, or bypass sharing and system constraints if needed. Doesn’t that sound exciting? Let’s check out how to make this happen!
Lulu Mobile uses standard Opportunity object to track their deals. They have two types of deals – for Existing Customers and New Customers. The team wants to enforce the naming convention as [Account Name] – [Type] – [Create Month/Year]. They also want to set a default Close Date. They want to close the deals in three months for new customers, and in one month for existing ones. Furthermore, if the opportunity is for the existing customers, they want to skip all the stages prior to Negotiation/Review.
The team doesn’t want to spend time filling in the fields that are to replace. Thus, they want to remove those fields from the creation page and let the system assign the values dynamically.
We will build a simple screen flow to achieve this by utilizing the Section and Fields features. We will also build formula resources and Decision elements to assign values dynamically. We will then build buttons and put them on List Views and Related Lists.
Note that some of the field types are not available for Fields, we have to use other components to create those fields.
Reference Articles |
---|
How to get myDomain with $API |
How To Redirect Users When Flows Finish |
Screen Flow | Create Records | Decision |
Screen Element | Record Id | Assignment |
Notes
This idea occurred to me when working with Manufacturing Cloud. For some major objects (ex. Account Manager Targets), standard users have no access rights without the “View Setup and Configuration” permission (It throws cross-reference error). To resolve this, created a screen flow to run in the system context.
Does the solution solve your problem? If not, write us what your problem is and we will build the flow for you!
Thanks for this!! Really helpful.
Any ideas how to run the flow via basic LWC? I have a requirement to override the tab’s New button with flow.
No problem Mike! Unfortunately I’m not a LWC expert – suggest you can ask around in the developer community:)
This is really cool, thanks so much – one question I have tho is if we are able to get rid of the ‘New’ button entirely so that users don’t have the option of selecting the standard ‘New’ button and must use the new ‘New’ button I have created. Is this possible? From what I have seen it might not be and that you have to override the ‘New’ button with an LWC or create a VFPage with the Flow embedded within it. Thanks for any clarity you can give on this!
Hi Chris, you can take a look at step 13/14, where you are given the option to remove “New” button on list view or related list. Hope this helps!
Thanks for this !! Does this work for external objects too, since cannot set that Account external object Id as variable
Hi Sam, it could be a bit difficult because by default external object is read only, but I suggest you look into writable external object to see if you can modify records directly from Salesforce.
This is helpful, but does not solve the problem of completely overriding the New button. Users can still create a new record from the Header under Opportunities > New Opportunity and bypass your custom new button.
This won’t be a truly supported solution until Salesforce lets us override standard buttons with Screen Flows instead of just Aura/VisualForce