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
MeerMeer 

Add and Update New Record via VF Page

Hi, I have the following class and page, I have added the Page in the  detail pagelayout of custom object 'Journal'. Now can anybody tell me how can I auto fill the Journal__c field in the VfPage  with the current Journal detail page. Plus I want to save this New Line for thr current Journal. Please help me

 

********** Class **********

 

public class Fin_LineManager
{

public Line__c newLine{get; set;}
public Fin_Journal__c newJournal{get; set;}


public Fin_LineManager(ApexPages.standardController stdn)
{
newLine = new Line__c();
newJournal = new Fin_Journal__c();
}

public PageReference save()
{
insert newLine;
return null;
}
}

 

 

********** Page **********

 

<apex:page standardController="Fin_Journal__c" extensions="Fin_LineManager">
<apex:form >

<apex:pageBlock >

 

<apex:panelGrid columns="4" cellspacing="2" cellpadding="1">

<apex:outputLabel >Journal ID: </apex:outputLabel>
<apex:outputLabel value="{!newline.Journal__c}"/>

<apex:outputLabel >Credit: </apex:outputLabel>
<apex:inputField value="{!newline.Credit__c}"/>
<apex:outputLabel >Debit: </apex:outputLabel>
<apex:inputField value="{!newline.Debit__c}"/>
<apex:outputLabel >Description: </apex:outputLabel>
<apex:inputField value="{!newline.Description__c}"/>
<apex:commandButton action="Fin_LineManager.save()" value="Save"/>
</apex:panelGrid>

 

</apex:pageBlock>

</apex:form>
</apex:page>

 

 

NOTE: I have a related list of 'Line' in the Journal Page, I want to Update and refresh that realted list as well so the user can see that New Line has been added successfully.

 

Thanks

 

Meer

LakshmanLakshman

Do Fin_Journal and Line have master-detail relationship?

 

Regards,

Lakshman

MeerMeer

yes they do have a Master Detail Relationship..