-
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
New Salesforce CDP Innovations For Smarter Customer Interactions
Salesforce CDP is also known as Salesforce Customer Data Platform helps organizations with improved personalized customer communication strategies. Yesterday Salesforce launched new CDP innovations to…
Process Builder in Salesforce - All You Need to Know
If you are thinking about how to perform business tasks automatically and also without even writing a single piece of code and you can perform…
Why Having a Preference Center is Key to Your Email Marketing Strategy | Salesforce Marketing Cloud
As Marketing Technology consultant, DemandBlue interacts with many digital marketers. Our team audits the full range of digital marketing assets that organizations manage. Based on…
Popular Salesforce Videos
Introduction to Set & Map in Salesforce || What is Set || What is Map ||
From Salesforce instructor, Become a Salesforce Expert. A brief introduction about what is a Set, map, and what are their importance? Check out the video to…
Learn About the Before Trigger in Salesforce Flows
Here I am creating 2 scenarios for before - Save Updates in Salesforce Flows Salesforce Summer '20 Flow Builder feature. Creating or updating a record…
Salesforce To Salesforce Integration Using REST API
Salesforce to Salesforce integration using REST API. In this video, you will learn how two Salesforce Orgs can be integrated using REST API. This tutorial…