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
Choudary KChoudary K 

Trigger to auto-populate fields with more than 500 values

I have two fields Occupation and Occupation codes with 580 values. When I select the Occupation (Developer), the Occupation code must be auto-populated as (0001). I am new to development and would be great if anyone can suggest a way or give references to do this using a trigger?
Sunil PalSunil Pal
HI Choudhry

Occupation code always be 0001 or it will change everytime. and Occupation (Developer) it will always developer or something else also can be there in this field ?

If this all are fixed then we can do without trigger I believe.
Choudary KChoudary K
Hi there, Occupation code changes with the Occupation.  Both the Occuption and Occupation codes are unique and I have 580 of them like this Developer --> 0001
Manager --> 0002
Tester --> 0003
Admin --> 0004, and so on. 

I tried some workarounds using Controlling/Dependent picklist and formula fields but due to the huge volume of the values, Salesforce has a limitation. and I felt that trigger can address this use case.

Thanks!