vijayk3327 / LWC

1 stars 0 forks source link

How to split values from multiple picklist to dropdown value in salesforce LWC #90

Open vijayk3327 opened 1 year ago

vijayk3327 commented 1 year ago

In this post we are going to learn about How to split values from multiple picklist to dropdown value in salesforce LWC.

A Picklist provides a user with an select-only component that is functionally similar to an HTML select element. It is accompanied with a listbox of pre-defined options. A picklist has both single and multi-selection patterns.

→ Get source code live demo link:-

Step 1:- Create Lightning Web Component : lookupFieldValueLwc.html

` `

Step 2:- Create Lightning Web Component : lookupFieldValueLwc.js

` import { LightningElement,track, api } from 'lwc';

export default class LookupFieldValueLwc extends LightningElement { @track accountId ; @track reportsToId;

handleChangeAction(event){
    if(event.target.name == 'accountId'){
        this.accountId = event.target.value;  
        //window.console.log('accountId ##' + this.accountId);
        if(this.accountId == '0015g00000y2ZQEAA2')
        {
            this.reportsToId = '0035g00000FroJAAAZ';
        }else{
            this.reportsToId = '';
        }

    }
    if(event.target.name == 'reportsToId'){
        this.reportsToId = event.target.value;  
        window.console.log('reportsToId ##' + this.reportsToId);
    }
}

}`

Step 3:- Create Lightning Web Component : lookupFieldValueLwc.js-meta.xml

` <?xml version="1.0" encoding="UTF-8"?>

56.0 true lightning__AppPage lightning__RecordPage lightning__HomePage ` **[→ Get source code live demo link:-](https://www.w3web.net/get-lookup-field-values-in-lwc/)**