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
JDevJDev 

Copying Addresses

I am using a picklist to set a preferred address to 1 of 4 sets of Address data on Contact and showing the results in formula fields as below (example is for Preferred Zip):
IF(ISPICKVAL(Preferred_Address__c, "Address 1"),
Address_1_Zip__c,
IF(ISPICKVAL(Preferred_Address__c, "Address 2"), Address_2_Zip__c,
IF(ISPICKVAL(Preferred_Address__c, "Address 3"), Address_3_Zip__c , Address_4_Zip__c )) )

I am also using a workflow rule to set standard Contact Mailing address fields to the equivalent preferred values and making them read only on the page layout to facilitate data exchange with third party email systems.

The problem I have is with State Code, which as a pick list in it's own right cannot be directly addressed this way. I was hoping to be able to use the Text() function or something similar so that the code for Preferred State would be:
IF(ISPICKVAL(Preferred_Address__c, "Address 1"),
TEXT(Address_1_State__c),
IF(ISPICKVAL(Preferred_Address__c, "Address 2"), TEXT(Address_2_State__c),
IF(ISPICKVAL(Preferred_Address__c, "Address 3"), TEXT(Address_3_State__c) , TEXT(Address_4_State__c ))) )
Any one have any workable approaches?