You need to sign in to do that
Don't have an account?

how can i get the details of an object in another object which are not related...
HI guys,
hey guys tis is my problem.. ters s a master object calld opportunity, and it has two child objects "products" and "services".. what i want nw is i want a button in d "services" related list of opportunity, So wenever i click tat button it should open a new page with d details of "Product " object.. hw can i do tis.....? pls help me.... Am a fresher in sfdc.... :(
Did you get any answer to this. I have the similar case. Please let me know.
I'm not exactly sure what your requirements are, but this might get you going in the right direction. You'll need 3 items to do this: a List Button on the Services object; a VF page; and an Apex Controller.
A simple Apex Controller
public class ServiceProductController {
Id opportunityId = null;
public ServiceProductController() {
opportunityId = ApexPages.currentPage().getParameters().get( 'id' );
}
public List<Products__c> getProducts() {
List<Products__c> products = new List<Products__c>();
for( Products__c prod : [ select Id, Name, field3, field4, ... from Products__c where Opportunity__c = :opportunityId ] ) {
products.add( prod );
}
return products;
}
}
VF Page - ServiceProduct
<apex:page controller="ServiceProductController">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:pageBlockSectionItem>
<apex:pageBlockTable value="{!products}" var="p">
<apex:column>
<apex:facet name="header">Product Name</apex:facet>
<apex:outputText value="{!p.Name}" />
</apex:column>
// add markup here to continue creating your columns.
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
List Button
Create a List Button on the Services object with the source being a URL. Add the following in the formula text box:
/apex/ServiceProduct?id={!Opportunity.Id}
Hope this helps!
~ Clint