-
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
The Benefits of Outsourcing Salesforce Admin Services for Agile Business Management
Agility is not just a fancy word in today's business world; it is a requirement. Businesses are always on the lookout for new and creative…
The All New Salesforce Sales Cloud to Help You Progress in a Digital-First World
Today Salesforce has announced the next generation of Sales Cloud, which is designed for a socially distant, digital-first world. This covers seven new features, some…
Important Strategies Lessons from Dreamforce 2024
Are you ready to discover how Salesforce's latest innovations at Dreamforce 2024 are reshaping the future of business? From cutting-edge AI integrations and the power…
Popular Salesforce Videos
Success from Anywhere with Salesforce EMEA Leaders
Watch this video to learn about Success from Anywhere with Salesforce EMEA Leaders. Do let us know your opinions in the comment section.
What are The Benefits of Salesforce Financial Services Cloud?
Business today is all about relationships. That’s nothing new. But how you go about managing and maintaining those relationships is completely different in today’s business…
Mastering Apex Collections | Salesforce Tutorial
Working with collections like List, Map and Set is part of the day’s routine for Apex developers. While their basic use is straightforward, there are…