Lighting Flows
Lightning Flows
Hands-On Presentation
Setup Document
Thank you for joining us for this session. We will be setting up a flow which expands the functionality of adding products to an Opportunity by allowing users to select the option to only show Products which have available inventory on them.
This flow will utilize a few custom components that will need to be installed prior to this session. Use the link below to access the package with these components:
- Sandbox Install Link - https://sforce.co/2HjJ3Pc
- Production/Dev org Install Link - https://sforce.co/2UCrkFS
- Installation Key is “sf19”
This package includes the following components:
- Inventory custom field on Products
- Inventory Controller Apex Class
- InventoryControllerTest Apex Class
- InventoryQty Aura Component Bundle
- InventorySelection Aura Component Bundle
- Modal Static Resource
Let's take a quick look at what we will be building:
On an Opportunity, when adding Products, the standard module brings up a list of all available products regardless of any other settings;
With the new module, we will be able to limit the Products being displayed based on available inventory:
Such a simple addition to standard functionality that can carry a big impact for many users. Let's get started on building the flow.
Go to Setup > Process Automation > Flows
Click New to open the Flow Builder and start a new Flow
Now let's start building (if you not very familiar with the new flow builder, follow along carefully, there are a few major differences to be aware of.)
Lookup Opportunity by dragging the “Get Records” component onto the builder
Variables are handled a little differently now:
Next we need to make sure a Pricebook has been defined on the Opportunity (yes, we are still bound by the pricebook requirement)
If no pricebook is assigned, we need to define one, the following Screen allows the user to select any active pricebook
Part of this is setting up a Choice element which pulls in the active Pricebooks
Now that a Pricebook has been chosen we need to update the Opportunity accordingly
Now that we have a price book, let's connect the elements we have so far
Don’t forget to save your work often, I don’t know about any of you but I have a bad allergy to data loss. The best cure is avoidance, save often.
Now that we have a pricebook defined and have saved our work, let's move onto getting the product selection in place
This first part will give us the product selection screen
Next, we will verify that we have some products selected
Now lets add the secondary product screen which will allow users to enter the quantities
The last component is to create the Opportunity line Items
Now lets connect all these components
Don’t forget to save your work
Now go activate your flow
Now that we have a flow, we need a way to access it
A fun way to do this is by adding it as a lightning component to a lightning page layout
Go to an Opportunity, click the gear in the upper right and go to Edit Page
There you go, save your new lightning page and go to an opportunity to check out your new flow for adding products with inventory
Comments
Post a Comment