• ABHISHEK CHOPRA
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
If an object has two Master Detail relatioship, how to check which one primary and which one secondary ?
Hi EveryOne, 
Below is my Apex and VF code. What i want to acheive is when i click on the record displayed in the Page block section on a list of Account then the detail page of the same record is displyed under that section.


Apex Code:- 
public class c4{
list <Account> acts1;
list <Account> acts2;

public list <Account> getacts1()
{
return acts1;
}


public list <Account> getacts2()
{
return acts2;
}

public pagereference direct()
{

acts1 = [Select Name , Type , Industry , Phone from Account where type='Customer - Direct'];
 return null;
}

public pagereference channel()
{

acts2 = [Select Name , Type , Industry , Phone from Account where type='Customer - Channel'];
 return null;
}
 
 }





VF Code:-

<apex:page controller="c4" sidebar="false" >
<apex:form >
<apex:pageBlock title="Account Classification on click of a button">
<apex:pageblockSection id="a" >

<apex:commandButton value="Customer-Direct" action="{!direct}" reRender="a">
<apex:pageBlockTable value="{!acts1}" var="abc">
<apex:column value="{!abc.Name}"/>
<apex:column value="{!abc.Type}"/>
<apex:column value="{!abc.Industry}"/>
<apex:column value="{!abc.Phone}"/>
</apex:pageBlockTable>
</apex:commandButton>


<apex:commandButton value="Customer-Channel" action="{!channel}" reRender="a">
<apex:pageBlockTable value="{!acts2}" var="xyz">
<apex:column value="{!xyz.Name}"/>
<apex:column value="{!xyz.Type}"/>
<apex:column value="{!xyz.Industry}"/>
<apex:column value="{!xyz.Phone}"/>
</apex:pageBlockTable>
</apex:commandButton>


</apex:pageblockSection>
</apex:pageBlock>

</apex:form>  
</apex:page>
Hi,
I have three objects.i.e. Car, Driver and Booking. Booking has Master-Detail relationship with the Car and Driver Objects. OWD of the Car is public Read/Write and for Driver it is Read only.
In such scenario, how the visibility and secuity setting of Booking will behave in the application.

Regards
Priyank