-
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
Optimize Costs and CRM With Salesforce Managed Services
Salesforce is a powerful cloud-based CRM tool trusted by businesses worldwide, including start-ups, small and mid-sized enterprises, as well as Fortune 500 companies. It leverages…
Salesforce Einstein AI: Everything you need to know about AI for CRM
Introduction Have you ever wondered how YouTube knows exactly what video you want to watch? Or perhaps you’ve been humming a tune all day, only…
6 Ways to Improve Salesforce Release Management
Salesforce was initially planned as a CRM. Be that as it may, it's become a mainstream improvement stage because of its natural usefulness. Salesforce uses…
Popular Salesforce Videos
Strategy Design Pattern in Salesforce | Video Tutorial
Design Patterns are very important for us to understand to develop an efficient apex code. Watch this video to learn all about it and do…
MuleSoft Integration: Google Ads Lead Form to Salesforce - Learn Salesforce Series by Algoworks
MuleSoft integration: Google Ads lead form to Salesforce. In this video, learn how MuleSoft can be used to integrate Salesforce with Google Ads lead form.…
Salesforce Connections 2018 Keynote - Ch. 2: Ticketmaster Is A Trailblazer
Salesforce Connections 2018 Keynote – Ch. 1: Corporate Positioning Salesforce Connections 2018 Keynote – Ch. 2: Ticketmaster Is A Trailblazer Salesforce Connections 2018 Keynote –…