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
yaminiyamini 

How to get the owner id of custom object if it contain master look up with another object

Hi, 

 

i have the custom object test it contain master look up with opportunity. And i have another object as testing.In testing i have a master look up with test object. Now i want to use the owner id of testing. How to get the owner id of testing. Please help me out. 

 

If i am want the owner id for test i use the query like

 

System.debug([select id,opportunity_name__r.ownerid from test__c]);

 

opportunity_name__c is master look up with opportunity in test.  Now i want the owner id of testing. How to use the query for getting the owner id of testing. please help me.

alok29novalok29nov

Try this.. You can change the name of object as required..

 

Select Name from Opportunity where   OwnerID IN (Select Id from test__c where
Name='abc')