Skip to content

Linear Path component for Picklist fields for any object with auto-scale functionality.

License

Notifications You must be signed in to change notification settings

Chaos-Tech-Corp/Linear-Path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy

Linear Path

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.

linear path example

It also mimics the Opportunity Path behaviour with any picklist, allowing for "Won" and "Close" values.

linear path example

Usage

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.

Component Properties

  • 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.

Lightning App Builder Editor Properties

  • 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'
NOTES & CONSIDERATIONS

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.

DIFFERENCES WITH THE PATH COMPONENT

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.

linear path example

DISCLAIMER

This component is based on the Path Blueprint from the Lightning Design System.

How to Deploy it in your Salesforce Org (Sandbox)

Open the Developer Console and proceed as follows:

  1. Create a new Apex Class (File > New > Apex Class) and name it: linear_path_controller.
  2. Create a new Lightning Component (File > New > Lightning Component) and name it linear_path.
  3. Copy and pase the code from the SRC directory into the recently created files.
    • For the lightning component:
      • COMPONENT: linear_path.cmp
      • CONTROLLER: linear_path.js
      • DESIGN: linear_path.design
      • STYLE: linear_path.css
    • For the Apex Class: linear_path_controller.apxc

Alternatively you can use deploy2.org to deploy directly from Github to your Sandbox.

Deploy

About

Linear Path component for Picklist fields for any object with auto-scale functionality.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published