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
Milo6996Milo6996 

Prevent from using Duplication Pick list values

Hi All

 

I have been asked to amend our salesforce and am unsure of the best way to do it

 

I have an object call "Voucher" with a dropdown list called CODE of all the current voucher codes. Long story short, the voucher has a master lookup to an account.

 

I want it so when we create a new voucher code record the user will select from the picklist the code and that picklist value can only be used once. If it has been used against another account the use cant save the record

 

Thanks

 

 

 

 

 

sfcksfck

Since there's no "unique" option for picklist fields, you will need to write an Apex trigger

UVUV

Go thorugh this to write a trigger to prevent duplicates-

http://www.forcebrain.com/apex-trigger-preventing-duplicate-records-level-advanced/