-
Custom setting not displying correct picklist values based on the condtion
i have a custom setting called the product and under that, I created two fields called and other is string field BD__c. i want to display picklist value based on string matching record. my custom setting looks like AAA |1,2,6,8 BBB |1,2,6,8 NNN|8 so when string value is 1,2,6,8 it should show AAA, BBB when its 8 it should show NNN, but i can see all the values even if BD__c==8
Here is my apex controller method. can someone suggest me what I am missing
public List < SelectOption > getTR_picklistvalue() { system.debug('******Start of getTR_picklistvalue'); List < SelectOption > options = new List < SelectOption > (); options.add(new SelectOption('', '--Select--')); Map < String, picklistvalue__c > Prod = picklistvalue__c.getAll(); List < String > keys = new List < String > (Prod.keySet()); keys.sort(); for (String key: keys) { if (Prod.get(Key).BD__c == '1,2,6,8') Options.add(new SelectOption(Prod.get(Key).picklistvalue__c, Prod.get(Key).Name)); else Options.add(new SelectOption(Prod.get(Key).picklistvalue__c, Prod.get(Key).Name)); //options.sort(); } return options; }
Log In to reply.
Popular Salesforce Blogs
10 Steps to a Sustainable Salesforce Org
Salesforce is one of the most widely used CRM platforms in the world, enabling organizations to streamline their sales, marketing, and customer service operations. However,…
Salesforce Integrations - Enterprise Portfolio Considerations
Why Salesforce Integration? What are the Benefits? We live in a world where even the smallest of organizations have multiple systems in their IT Footprint…
DML Operations in Apex: All You Need to Know
In this Blog, we will study DML Operations in Apex. DML is used to insert, update, delete and undelete records. We can use upsert to…
Popular Salesforce Videos
Entrepreneurship in the Salesforce Ecosystem
The Salesforce Women’s Entrepreneur Group is a group of women who have founded and own businesses in the Salesforce ecosystem. Our goal is to inspire,…
5 Things Salesforce Lightning Does Better
In this 30-minute recorded webinar, Jamie Grettum talked about her favorite Lightning features, how to set them up, and how to get hands-on experience with…
What is Headless Commerce in Salesforce Commerce Cloud?
With the advent of COVID, the buying journey of customers has changed significantly. As a result, brands need to keep up with this change and…