You need to sign in to do that
Don't have an account?
Suresh Raghuram
Avoid adding duplicate values into picklist
Hi Community,
Below is the sample code
List<User> salesOffice = [Select id, Sales_Office__c, profile.Name from User where Sales_Office__c != null];
for(User usr: salesOffice){
this.pickList.add(new salesOffice(usr.Sales_Office__c, usr.Sales_Office__c));
}
From the above process I am getting the duplicate values in the picklist and displaying in the alphabetical order.
Any Ideas please.
Thanks,
Suresh.
Below is the sample code
List<User> salesOffice = [Select id, Sales_Office__c, profile.Name from User where Sales_Office__c != null];
for(User usr: salesOffice){
this.pickList.add(new salesOffice(usr.Sales_Office__c, usr.Sales_Office__c));
}
From the above process I am getting the duplicate values in the picklist and displaying in the alphabetical order.
Any Ideas please.
Thanks,
Suresh.
Do u have duplicate values in Sales_Office__C field?
If yes then loop through the salesOffice list and put it into a set<String>.