Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Say I have a custom object, Division, that has two fields: name and address.

Say I want to make 2 custom fields in User (standard object):

field 1 is the User's Division: a picklist, populated by the names of all unique existing Divisions.

Field 2 is the User's Address: a text field, autofilled from the corresponding Division address (e.g. if User A is in Division B, then User_A.Address = Division_B.Address).

Is there a way to relate a standard object to a custom object in this manner?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

You cannot create Lookups on User - thus you cannot have a relationship between User and Division. You still have a couple options depending on how scalable you need this solution to be.

  1. User.Address (field 2) should be a Formula (text). This field will use CASE() to determine the Address based on User.Division (Field 1). This solution is the easiest to implement, but it is not ideal because any changes to Divisions will need to be made to both the Division records and the User.Division formula.
  2. Trigger on User object. This trigger can query Division records to find a Divison where Division.Name == User.Division. Then populate, User.Address with Division.Address. This solution is more dynamic and maintainable, but it will be a lot more work to implement.
share|improve this answer
    
I went with the Trigger method, which ended up working perfectly. Thanks for the help! –  gfppaste Jan 24 '13 at 19:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.