-
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
Salesforce Data Migration: Best Practices and Tips
Migrating data to Salesforce is a crucial step for businesses transitioning from legacy systems or consolidating multiple data sources into one powerful CRM. Done right,…
Building an Azure DevOps Pipeline for Salesforce Scratch Org Automation: A Journey to Success
It's exciting to solve a challenging problem. I recently went through such a journey when tasked with automating Salesforce Scratch Org Automation workflows through Azure…
How Are Salesforce Managed Services Beneficial For The Businesses?
Salesforce is a well-renowned name in the CRM industry that provides a 360-degree view of the users to all the departments that enable businesses to…
Popular Salesforce Videos
How to Get Started on Your Salesforce Admin Certificate with Trailhead
In this video, Brad discusses how to get started with your Salesforce career using trailhead. He discusses how to create and validate your account, the…
Salesforce Business Analyst Training
In the 35th Episode of the #AskTheHulk series, Savitha Asked about how to switch to IT from Non-IT background. To this question, Shrey suggested that…
How Cyntexa Helped An Educational Firm | Salesforce Training
Here is a testimony of how Cyntexa helped an educational firm build a single place to keep all data. Swipe to know what the challenges…