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

Relating IDs of two custom objects

Need to compare ids of two objects in Master Detail Relationship. The two objects are Product and Booking. I've to compare them and to fetch their fields mapping their ids.


If you are mentioning salesforce Record's ID for object .Then record IDs were always unique . However ,you could use below syntax for relating two obejcts (have Mastr detail Releationship) .


Select Id ,(select Test__r from Booking__C) from Product ;


OR similarly, 

List<Product> Lst_product = [Select Id ,(select Test__r from Booking__C) from Product ];


Above will be able to relate two objects (which has M Detail Relationship)