How to create Custom Path using Lightning web component?

on

|

views

and

comments

Table of Contents

Introduction

Hello #Trailblazers,

In this blog post, we will learn how we can develop a custom path using the lightning web component. We all know that we have a standard path component that can work in most of the scenarios however there are many use cases where you might need to implement a custom path.

For Example, you need to have a custom logic when a value in the path is selected or you wanted to display the path in Lightning flows in those scenarios you need to develop a custom path.

Features

This component has the following features

  1. The component can be used inside Record Page & Lightning Flows
  2. The component can be used to display the picklist based on record types
  3. Can pass values manually if the field is not picklist

Limitations

This initial version of the component has some limitations.

  1. Not all objects can be used to display the picklist
  2. The supported objects can be found here

Configure component

Once you have created the lightning web component.

You can either add the component inside any record page or inside lightning flows.

configure record page

Open any record detail page, click on the gear icon and then click on the Edit page


Now, as you are there inside lightning app builder for record page. 

From the left-hand side search for “path component” & drag and drop on the page where you wanted to add.

Configure input element

Once you have dragged the component, time is to configure the input elements

  1. Record Id – If you are inside record detail page you can leave this field blank
  2. Object API Name – If you are inside record detail page you can leave this field blank
  3. Picklist Field API Name – The field API name which has the values to display in the path
  4. The Current Value of Picklist – If you are inside record detail page you can leave this field blank
  5. Type of path – The type of the path. Valid values are base & path
  6. The picklist field values – If you wanted to create a path without using picklist values then you can pass the values here comma separated
  7. Location of the button – Where you wanted to display the button. Valid values are Top & SameRow
  8. The label of the button – What should be the label of the button
  9. The Name of the record type – If you are using the record type for the object then provide any values while using the component inside record detail page
  10. Show Action button – The boolean value which will indicate either to display the button or not

Output

Complete Code

Amit Singh
Amit Singhhttps://www.pantherschools.com/
Amit Singh aka @sfdcpanther/pantherschools, a Salesforce Technical Architect, Consultant with over 8+ years of experience in Salesforce technology. 21x Certified. Blogger, Speaker, and Instructor. DevSecOps Champion
Share this

Leave a review

Excellent

SUBSCRIBE-US

Book a 1:1 Call

Must-read

How to Utilize Salesforce CLI sf (v2)

The Salesforce CLI is not just a tool; it’s the cornerstone of development on the Salesforce Platform. It’s your go-to for building, testing, deploying, and more. As one of the most important development tools in our ecosystem

Save the day of a Developer with Apex Log Analyzer

Table of Contents What is Apex Log Analyzer? Apex Log Analyzer, a tool designed with Salesforce developers in mind, is here to simplify and accelerate your...

Salesforce PodCast

Introduction Hey Everyone, Welcome to my podcast, the first-ever podcast in India for Salesforce professionals. Achievement We are happy to announce that we have been selected as Top...

Recent articles

More like this

4 COMMENTS

    • If you are using for Child Picklist then why you would want on parent object layout? That does not make sense to me. But if you still want to then you need to pass the Picklist Values manually

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Hi Amit, Its a great article with great solution as always from you. I would like to know, how can add Guidance to each step in this solution ? Looking forward to hear from you.Thanks . Can I show some custom message say ( Like 2 days in Draft etc below or hover on a Status ) in each Stage .How to create Custom Path using Lightning web component?
5/5

Stuck in coding limbo?

Our courses unlock your tech potential