+ Start a Discussion
MeerMeer 

Related List View modification

Hi..

 

I have a custom Object named as 'Journal' in the detail view of the Journal it shows the related list of custom object 'Line', I want to change the layout of the realted list of 'Line'. Can anyone tell me how can I change the layout of this related list??

Best Answer chosen by Admin (Salesforce Developers) 
Alok_NagarroAlok_Nagarro

Hi Meer,

 

Just you need to create a class as extension that would used for custom logic, plz refer the below code -

 

//------------page---------------

<apex:page standardController="Journal__c" extensions="MyExtension">

<apex:form>

<apex:pageBlock>

<apex:pageBlockButton>

  <apex:commandButton value="Save" action="{!save}"/>

</apex:pageBlockButton>

 

<apex:pageBlockSection>

     <apex:pageBlockSectionItem>

        <apex:inputField value="{!newLine.name}"/>

    <apex:pageBlockSectionItem>

<apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>

 

 

//-----------------class----------------------

 

public class MyExtension

{

public Line__c newLine{get; set;}

 

public MyExtension(ApexPages.standardController stdn)

{

newLine=new Line__c();

}

 

public PageReference save()

{

  insert newLine;

  return null;

}

 

}

 

As example in this page you would be able to create Line__c object's record and you can also use the same pattern to create another object's record in this page.

All Answers

Alok_NagarroAlok_Nagarro

Hi Meer,

 

You need to go your custom object detail page and edit the page layout of that object, follow the below steps -

 

Goto Setup--> App Setup--> Create--> Objects--> Click on "Journal" object link --> scroll down the page to "PageLayout Section" --> Click on edit link

 

Now you will have layout page, scroll down the page to related list section and now here you have a setting image for every related list header--> just clcik on the image  --> change layout display ---> click on save.

Devendra@SFDCDevendra@SFDC

 

Hi Meer,

 

Do you want to add/remove columns from related list?

 

If yes then Go to pagelayout of Journal Object-->You will se Line Object in the related list section-->Click On Related List Properties section

-->Add/Remove cloumns for Related List  "Line" object

 

Thanks,

Devendra

MeerMeer

Actually I am looking to design a layout in which I can create a new record for the realted list being on the same page.. Let me make it more clear, I have two custom objects 'Journal' and 'Line'. In Journal I have a related list of 'Line', now when i click 'New Line' It is directed to New Line page where I can create New Line, now I dont want to migrate to another page but want to have all the feilds of Line object in the same pagel block or section where i can create a New LIne. I guess its quie brief explanation to make u understand.

 

Regards,

 

Meer

Alok_NagarroAlok_Nagarro

Hi Meer,

 

It is not possible with related list, however you can add a section in layout and create a visualforce page to create NewLine records and drop this page in that section. And make sure when you create page that standard controller must be NewLine_apiName so that it can be available for NewLine object's layout.

MeerMeer

ok how can I get the fields of other custom object in my vf page? I want to provide the input feild to the user..

Alok_NagarroAlok_Nagarro

Hi Meer,

 

Just you need to create a class as extension that would used for custom logic, plz refer the below code -

 

//------------page---------------

<apex:page standardController="Journal__c" extensions="MyExtension">

<apex:form>

<apex:pageBlock>

<apex:pageBlockButton>

  <apex:commandButton value="Save" action="{!save}"/>

</apex:pageBlockButton>

 

<apex:pageBlockSection>

     <apex:pageBlockSectionItem>

        <apex:inputField value="{!newLine.name}"/>

    <apex:pageBlockSectionItem>

<apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>

 

 

//-----------------class----------------------

 

public class MyExtension

{

public Line__c newLine{get; set;}

 

public MyExtension(ApexPages.standardController stdn)

{

newLine=new Line__c();

}

 

public PageReference save()

{

  insert newLine;

  return null;

}

 

}

 

As example in this page you would be able to create Line__c object's record and you can also use the same pattern to create another object's record in this page.

This was selected as the best answer
MeerMeer

Perfect!! Thanks a lot dear