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
alexander yurpolskyalexander yurpolsky 

Populating field according to the conditions

Hello,

I have two related objects:
1. Streets object
2. Ships object

User-added image
In the Contacts object I have a pickup list field to select a street (from the Street object)  I also have a text field to enter a house number. After the user has selected the street and entered the house number. I want to display in third text box and the shipping id from the ships object. But - I need to check which shipping id related to the house number. For example: Street 1 has 2 ship id  according to the house number.
House numbers from 0 to 10 related to code 11 and house numbers 11-30 related to id 22.

Would love your help.



 
KdKomalKdKomal
Hi Alexander,

Just to be clear that i get you pt. how street object and Contact objects are related  and what does "pickup list field to select a street " means? 

 
alexander yurpolskyalexander yurpolsky
The relationship between contacts to  streets is one-to-many = One street to many contacts.
When the user enters the contact information, he selects a street from a list (a Lookup Relationship field)
 
KdKomalKdKomal
Thank you for the clearification. 

You would need a customization approach like a VF page for this. will that be fine ?
 
Narender Singh(Nads)Narender Singh(Nads)
Hi Alexander,
In order to populate that third text box field you will need to write a trigger on Contact object.
What I can't properly understand is what all values you want to populate in that third text box field.
alexander yurpolskyalexander yurpolsky
sorry I wasn't clear enough.
I need to populate the value "ship ID". 
let's say my user-selected street 1 (street id 1  in my example) then he put the house number which for the purposes of this example will say it's 15. since he select Street 1and enter house number 15 I would like to populate the Third textbooks with the value 22 because 15 is between the range of 11-30 in this range is related to Street 1.