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
Chris HeathChris Heath 

Assigning a field a value based on Zip Code?

Hello,

I am trying to set up a trigger to update fields on a Lead object when said Lead is created.

What I'd like to do is set it up so that it assigns the Lead a Centile number based on the Zip Code.

I have an excel file mapping 30,000+ zip codes to these Centiles.

I cannot create a trigger that just says "If zip code is this, centile is this..." 30,000+ times because that will quickly reach the 100,000 character limit.

How would it be recommended that I complete this task?

Thank you,
Best Answer chosen by Chris Heath
ShashForceShashForce
Hi Chris,

The best way to approach this is to create a "Zip Code" custom object with a zip code field and a Centile number field, and insert your 30000+ zip codes as records. Once this is done, you can write a trigger on lead to query the zip code object for the centile number and update the lead.

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank