{"id":6603,"date":"2022-02-14T03:49:36","date_gmt":"2022-02-14T03:49:36","guid":{"rendered":"https:\/\/www.greytrix.com\/blogs\/salesforce\/?p=6603"},"modified":"2024-09-04T06:43:39","modified_gmt":"2024-09-04T06:43:39","slug":"how-to-create-multi-select-pick-list-field-using-lightning-web-component","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/02\/14\/how-to-create-multi-select-pick-list-field-using-lightning-web-component\/","title":{"rendered":"How to Create Multi-Select Pick-list Field Using Lightning Web Component"},"content":{"rendered":"\n<p>This blog will help you learn about creating Multi-Select pick-list field using Lightning Web Component thus allowing users to select multiple pick-list values in any standard Salesforce object field. <\/p>\n\n\n\n<p><strong>To implement Multi-Select pick-list we need a very basic UI with two standard lightning web component:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>lightning-combo box<\/li>\n\n\n\n<li>lightning-pill<\/li>\n<\/ol>\n\n\n\n<p>To start with, we will use lightning-combo box to show all pick-list values and can be further carried out through lightning-pill that will help to show selected pick-list values. <\/p>\n\n\n\n<h2 class=\"wp-block-heading has-vivid-red-color has-text-color has-link-color wp-elements-bac886752c761236fd5ccb1cbf1c7f28\"><strong>Creating basic HTML file:<\/strong><\/h2>\n\n\n\n<center><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2022\/02\/1_multiselectpicklistcmp.html-file.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" class=\"size-full\" style=\"border: 1px solid #A9A9A9; padding: 2px; margin: 2px; align: center;\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2022\/02\/1_multiselectpicklistcmp.html-file.png\" alt=\"Multi Select Picklistcmp.html file\"><\/a><\/center>\n<font size=\"2\"><center><i>Multi Select Picklistcmp.html file<\/i><\/center><\/font>\n\n\n\n<p>A lightning-pill is used to display a label which contains multi-picklist values; there are contained in links and is also removable as well. <\/p>\n\n\n\n<p>A lightning-combo box is used to select only one option from the pick-list with the use of on change event handler to capture whatever user selects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-vivid-red-color has-text-color has-link-color wp-elements-51319e67a44f443b4da10a76b30806e1\"><strong>Following is the logic used in JavaScript:<\/strong><\/h2>\n\n\n\n<center><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2022\/02\/2_multiselectpicklistcmp.js-File.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" class=\"size-full\" style=\"border: 1px solid #A9A9A9; padding: 2px; margin: 2px; align: center;\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2022\/02\/2_multiselectpicklistcmp.js-File.png\" alt=\"Multi Select Picklistcmp.js File\"><\/a><\/center>\n<font size=\"2\"><center><i>Multi Select Picklistcmp.js File<\/i><\/center><\/font>\n\n\n\n<p><strong>handleChange :<\/strong> This method is handling the change on pick-list field. If user is selecting any new value which is not selected before then we are adding that value to allValues list.<\/p>\n\n\n\n<p><strong>handleRemove:<\/strong> This method is removing selected values from all Values using basic methods of Javascript<\/p>\n\n\n\n<center><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2022\/02\/3_Output-Interface..png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" class=\"size-full\" style=\"border: 1px solid #A9A9A9; padding: 2px; margin: 2px; align: center;\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2022\/02\/3_Output-Interface..png\" alt=\"Multi Select Picklist Output Interface.\"><\/a><\/center>\n<font size=\"2\"><center><i>Multi Select Picklist Output Interface.<\/i><\/center><\/font>\n\n\n\n<p>The above message shows Multi-picklist values that enables user to select upon different options in a drop-down field.<\/p>\n\n\n\n<p>We hope that you find this blog helpful, if you still have queries, don\u2019t hesitate to contact us at <a rel=\"noreferrer noopener\" href=\"mailto:salesforce@greytrix.com\" target=\"_blank\">salesforce@greytrix.com<\/a>.<\/p>\n\n\n\n<p style=\"text-align: justify\"><b>About Us<\/b><\/br>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> \u2013 a globally recognized and one of the oldest Sage Development Partner and a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners and Sage PSG across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that require apex code incorporation into the Salesforce platform.<br><br> Greytrix has some unique solutions for Cloud CRM such as <a href=\"\">Salesforce Sage integration<\/a> for <a href=\"https:\/\/www.greytrix.com\/sage-x3-erp\/integration\/\">Sage X3<\/a>, <a href=\"https:\/\/www.greytrix.com\/salesforce-cloud-services\/sage-100-integration\/\">Sage 100<\/a> and <a href=\"https:\/\/www.greytrix.com\/salesforce-cloud-services\/sage-300-integration\/\">Sage 300 (Sage Accpac)<\/a>. We also offer best-in-class Cloud CRM <a href=\"https:\/\/www.greytrix.com\/salesforce-cloud-services\/crm-development\/\">Salesforce customization and development services<\/a> along with services such as Salesforce <a href=\"https:\/\/www.greytrix.com\/salesforce-cloud-services\/data-migration-support\/\">Data Migration<\/a>, <a href=\"https:\/\/www.greytrix.com\/salesforce-cloud-services\/crm-development\/\">Integrated App development<\/a>, Custom App development and Technical Support business partners and end users. Salesforce Cloud CRM integration offered by Greytrix works with Lightning web components and supports standard opportunity workflow. Greytrix GUMU&#x2122; integration for Sage ERP \u2013 Salesforce is a 5-star rated app listed on <a href=\"https:\/\/appexchange.salesforce.com\/appxListingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<br> The GUMU&#x2122; Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button.<br><br> For more information on our Salesforce products and services, contact us at <a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n\n\n\n<p><strong>Related Posts<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/01\/10\/how-to-create-a-quote-template-in-salesforce\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/01\/10\/how-to-create-a-quote-template-in-salesforce\/\" rel=\"noreferrer noopener\">How To Create A Quote Template In Salesforce?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2021\/09\/22\/how-to-use-email-template-in-apex-code\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2021\/09\/22\/how-to-use-email-template-in-apex-code\/\" rel=\"noreferrer noopener\">How to Use Email Template in Apex Code<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/01\/17\/how-to-create-records-from-apex-restful-service-in-salesforce\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/01\/17\/how-to-create-records-from-apex-restful-service-in-salesforce\/\" rel=\"noreferrer noopener\">Create records from Apex Restful Service<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2021\/08\/14\/how-to-avoid-null-pointer-exception-by-using-safe-navigator-operator\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2021\/08\/14\/how-to-avoid-null-pointer-exception-by-using-safe-navigator-operator\/\" rel=\"noreferrer noopener\">How to Avoid Null Pointer Exception By Using Safe Navigator Operator (?.)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2021\/08\/17\/how-to-create-a-dynamic-multi-filter-object-in-salesforce-part-i\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2021\/08\/17\/how-to-create-a-dynamic-multi-filter-object-in-salesforce-part-i\/\" rel=\"noreferrer noopener\">Create a dynamic multi-filter object in Salesforce-Part I<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/01\/31\/how-to-call-the-apex-method-in-lightning-web-component\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/01\/31\/how-to-call-the-apex-method-in-lightning-web-component\/\" rel=\"noreferrer noopener\">How to call the apex method in lightning web component<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog will help you learn about creating Multi-Select pick-list field using Lightning Web Component thus allowing users to select multiple pick-list values in any standard Salesforce object field. To implement Multi-Select pick-list we need a very basic UI with two standard lightning web component: To start with, we will use lightning-combo box to show\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2022\/02\/14\/how-to-create-multi-select-pick-list-field-using-lightning-web-component\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":9449,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1262,1259,206,207,1264,208,1050,1263,1049,1261,1260,259,367,651],"class_list":["post-6603","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce-srv","tag-drop-down-list","tag-field-drop-down","tag-lightning","tag-lightning-basics","tag-lightning-combo-box","tag-lightning-component","tag-lightning-web-component","tag-lightning-pill","tag-lwc","tag-multipicklist","tag-multiselectpicklist","tag-picklist","tag-salesforce","tag-salesforce-lightning-component"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/6603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=6603"}],"version-history":[{"count":3,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/6603\/revisions"}],"predecessor-version":[{"id":9448,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/6603\/revisions\/9448"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media\/9449"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=6603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=6603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=6603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}