how to define relationship between two objects in salesfoce code example
Example: how to define relationship between two objects in salesfoce
From Setup, go to Object Manager | Favorite.
On the sidebar, click Fields & Relationships.
Click New.
Choose Lookup Relationship and click Next.
For Related To, choose Contact. For the purposes of DreamHouse, contacts represent potential home buyers.
Click Next.
For Field Name, enter Contact, then click Next.
Click Next, Next, and Save.
On the Object Manager page for the custom object, click Fields & Relationships.
Click New.
Select Master-Detail Relationship and click Next.
For Related To, choose Property.
Click Next.
For Field Name, enter Property and click Next.
Click Next, Next, and Save.
From the App Launcher (The App Launcher icon. in the navigation bar), find and select Sales.
Click the Properties tab in the navigation bar. If you don’t see it, look under the More dropdown.
Click the name of a Property record.
Click Related. You’ll see Favorites (0) in the related tab.
Click New.
Enter a name for Favorite Name, then click Save.