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
subbu123.pbt@gmail.comsubbu123.pbt@gmail.com 

Master-Detail Relation ship

I create 2 objects ,

one is "A" this is master object 

second is "B" this is detail object

              problem is standardcontroller="A" (master) , in visualforce i have to read the "B" (detail)  field  ?

                    

                   is it possible ? if possible how? ,not possible how do this ?

testrest97testrest97

You have to use controller extension.....your query might look like

 

select id,(select id from b__r)from a__c;

ryanjuptonryanjupton

testres97, you can't query from a parent to a child or master to detail that way. Check here for more detail: http://blogs.developerforce.com/developer-relations/2013/05/basic-soql-relationship-queries.html

testrest97testrest97

Am I missing something?

yes you can

 

SELECT Account.Name,(SELECT Contact.Name FROM contacts) FROM Account

 

Account parent, contact child

 

In this case

 

select id,(select id from b__r)from a__c;

 

b is child, a is parent....only thing is you have to use the plular of b object ...may be something like bs

 

select id,(select id from bs__r)from a__c;

ryanjuptonryanjupton
Yep, apologies. I read your reply way to quickly and responded even more too quickly.
subbu123.pbt@gmail.comsubbu123.pbt@gmail.com
I will call from Visualforce page , not write any method or any query .
can write quey in visual force ?
testrest97testrest97

Don't think its possible. You can go from child to parent without soql but not vice versa