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
Matt Rich 7Matt Rich 7 

Can I create a field to field relationship?

I have created a custom object within Salesforce called "Service Requests". Within the "Service Requests" object I have created a custom field called "Store Number". "Store Number" is a lookup relationship field that is related to another custom object called "Stores". When a service request is made we always include the store number so that we can tell which store needs service done. For instance, Service Request 0006 is for store number 2368. Now, if we use our mouse to hover over the store number, 2368, then we will see a hover detail window telling us that the store is located in East Stroudsburg, PA. My question is, can I somehow relate the location of the store to the service request that is being made for that store? I want to be able to see the city and state that the service request is in. So, I should be able to tell that Service Request 0006 is a service request for East Stroudsburg, PA based off the fact that the service request is for store number 2368 (which is located in East Stroudsburg, PA). Am I being clear?

Let me break it down further:
Basically my client wants to be able to go into the "Service Requests" tab and, under the list views, he wants to see not only the "Request Number" (0006) and "Store Number" (2368) but also the city and state of the store (which would be related to the Store Number). I have already created a "City" and "State" field within the "Service Requests" object that is a picklist field allowing you to choose some predefined cities and states. But my client doesn't want to have manually choose a city and state each time he makes a service request. He is already having to manually look up the store number for each request, so he shouldn't have to pick from cities and states either. He wants it to where, once the store number is chosen, the city and state of that store will automatically populate within the "City" and "State" fields. Is this possible? Can I somehow create a field to field relationship to make this work? Will this require writing some Apex? I hope I am making sense. Thank you very much for taking the time to help me!
You could try doing a formula field that would display the value according to the store number. If that doesn't work, yes, you will have to do some apex code to bring in the information needed
Matt Rich 7Matt Rich 7
Great! Thanks for the reply. Now I am wondering, what formula should I use? I was trying to use VLOOKUP but was having some trouble, apparently my syntax is not correct. I am still new to this part of Salesforce. Can anyone help me in creating this formula? Thanks!
It would be a text formula field, and you can use the wizard to relate that to the store__c object fields. You will need one formula field for each field that you want to auto populate