This component creates a linear path view from a picklist field in any object in Salesforce and allow to scale down the component to fit in its parent container.
It also mimics the Opportunity Path behaviour with any picklist, allowing for "Won" and "Close" values.
Define the linear_path
component in a custom component markup:
<aura:component>
<c:linear_path fieldName="StageName"
recordId="{!v.recordId}"
scale="true"/>
</aura:component>
The component is available in the lightning page designer, so it can be added to any record page without writting any code.
fieldName
(String) - Name of the picklist field to display.recordId
(String) - Id of the record to use.scale
(Boolean) - Default value is false. Indicates whether the path will be scaled down to fit in its container.closedValues
(String) - List of the values of the picklist assigned as Closed/Won, separated by semi-colon;closedLostValues
(String) - List of the values of the picklist assigned as Closed/Lost, separated by semi-colon;closedValueName
(String) - Display value for the last option of the picklist where all Close values are grouped.
Field Name
(String) - Name of the picklist field to display.Enable Scaling?
(Boolean) - Default value is false. Indicates whether the path will be scaled down to fit in its container.Closed Won Values
(String) - List of the values of the picklist assigned as Closed/Won, separated by semi-colon;Closed Lost Values
(String) - List of the values of the picklist assigned as Closed/Lost, separated by semi-colon;Closed Value Text
(String) - Display value for the last option of the picklist where all Close values are grouped.
Exmaple configuration for the image above:
Picklist field named demo with values: Draft, Initiated, Pending, Proposed, Signed, Activated, Cancelled.
- Field Name: 'Demo__c'
- Enable Scaling?: false
- Closed Won Values: 'Activated'
- Closed Lost Values: 'Cancelled'
- Closed Value Text: 'Activated'
If scale is set to false, content will be hidden if it doesn't fit in the container, otherwise it will scale down to fit in the available space.
It has special management for the StageName field in the Opportunity
object (try to mimic it), so it won't show the closed values, instead it will display just Close, unless the Opportunity it is closed, it will then show the StageName value, same as the generic Lightning Path component.
Current version has no functionality, just displayes the picklist values.
This component is for display purposes only of the picklist, it does not contain the Mark Stage as Complete button and does not display the StageName.
In the image below:
- First is the
Path
component showing the path updated button. - Second is the
Path
component hiding the path update button. - Third is the
Linear Path
component, without the update button and the Stage Name label, note there is no padding or marging left from the empty containers of the label and the button.
This component is based on the Path Blueprint from the Lightning Design System.
Open the Developer Console and proceed as follows:
- Create a new Apex Class (File > New > Apex Class) and name it:
linear_path_controller
. - Create a new Lightning Component (File > New > Lightning Component) and name it
linear_path
. - Copy and pase the code from the SRC directory into the recently created files.
- For the lightning component:
COMPONENT
: linear_path.cmpCONTROLLER
: linear_path.jsDESIGN
: linear_path.designSTYLE
: linear_path.css
- For the
Apex Class
: linear_path_controller.apxc
- For the lightning component:
Alternatively you can use deploy2.org
to deploy directly from Github to your Sandbox.