function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DeepikareddyDeepikareddy 

hi to check duplicated in the List and show a pop-up in salesforce

list<string> Productdetails = new list<string>();

empdetails.add('sony');
empdetails.add('samsung');
empdetails.add('Voltas');
empdetails.add('bluestar');


list<string> Itemdetails = new list<string>();

empdetails.add('LG');
empdetails.add('samsung');
empdetails.add('Butterfly');


 need to check it if the duplicate is ther, need to show a pop up as already exists,with bootstrap popup model

thanks 
deepika 
ANUTEJANUTEJ (Salesforce Developers) 
Hi  Deepika,

In case if you want to stop people from entering a value already present in list then I think you can make use of a set so that the values are not duplicated.

I hope this helps in case if it does can you please choose this as the best answer so that it can be used by others in the future.

Regards,
Anutej
DeepikareddyDeepikareddy
hi anutej,thanks for your reply,  my requirement is to use the List and if any duplicates present , jst need to add the pop of of default ,bootstrap, iam thinking to add a flag as true and flase and display it depending on the dupliactes checking


thanks
Deepika 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Deepika,

If that is the case instead of appending th values directly by hardcoding, one possibility I could think of is to have a input box and have an add button to append to the list and on clicking on add you can have an alert to state your message in case if there are any duplicates present in the list.

I hope this helps.

Regards,
Anutej