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

Inline Visualforce Related list..Record is not saving

I created a linline visualforce page for the child and that placed it on Parent obj i.e when a parent record(Like Account) open in bottom then child obj(Like Contact) fields shown and we enter the values and save it this is my vf page...Here my problem is when parent record(Account) is open then in bottom Contact Vf page Account field automatically Created with which account you opened..   when i save then this error is coming

" System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Call2]: [Call2]
Error is in expression '{!Save}' in component <apex:commandButton> in page productrelated "

Here call2__C is parent obj and product__c is child object..

Visualforce Page

<apex:page standardController="Call2__c" sidebar="false" extensions="Add">
<apex:outputField value="{!Call2__c['Name']}" />
<apex:form >
<apex:pageblock id="pb" >
    <apex:pageBlockButtons >
        <apex:commandbutton value="Add" action="{!Addrow}" rerender="pb1"/>
        <apex:commandbutton value="Save" action="{!Save}" />
     <apex:pageMessages />
      <apex:pageblock id="pb1" >
         <apex:repeat value="{!lstInner}" var="e1" id="therepeat">
                <apex:panelGrid columns="6">
                <apex:panelGrid headerClass="Name">
                    <apex:facet name="header">Del</apex:facet>
                    <apex:commandButton value="X" action="{!Del}" rerender="pb1">
                        <apex:param name="rowToBeDeleted" value="{!e1.recCount}" assignTo="{!selectedRowIndex}"></apex:param>
            <!--    <apex:panelGrid title="header" >
                    <apex:facet name="header">Call</apex:facet>
                    <apex:inputfield value="{!}"/>
                </apex:panelGrid>  -->
                       <apex:panelGrid title="header" >
                       <apex:facet name="header">Call</apex:facet>
                    <!--   <apex:outputLink value="/{!}">{!}</apex:outputLink>
                           <apex:inputfield value="{!}"/>
                        <apex:outputField value="{!}"/>-->
                        <apex:outputField value="{!Call2__c['Name']}" />
                <apex:panelGrid title="header" >
                    <apex:facet name="header">Quantity</apex:facet>
                    <apex:inputfield value="{!}" />
                <apex:panelGrid >
                    <apex:facet name="header">Product</apex:facet>
                    <apex:inputfield value="{!}" />
                <apex:panelGrid >
                    <apex:facet name="header">Item</apex:facet>
                    <apex:inputfield value="{!}" />
                <apex:panelGrid >
                    <apex:facet name="header">Notes</apex:facet>
                    <apex:inputfield value="{!}"/>



public class Add
    Public List<product__c> lstpro{get;set;}
    Public List<product__c> edpro{get;set;}
    Public call2__c cl;
    public String var {get;set;}
    public List<innerClass> lstInner {get;set;}
    public String selectedRowIndex {get;set;} 
    private List<product__c> calln;
    public id calid;
    public Integer count = 1;

    public PageReference Save()
        var= ApexPages.currentPage().getParameters().get('Id');   
        PageReference pr = new PageReference('/apex/productrelated?'+var);
       // PageReference pr = new PageReference('/';
       // PageReference pr;
       // pr = Page.productrelated;
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error:Fields Can not Null');
        for(Integer j = 0;j<lstInner.size();j++)
        insert lstpro;
        return pr;
    public void Addrow()
        count = count+1;

    public void addMore()
        innerClass objInnerClass = new innerClass(count);
    public void Del()
        count = count - 1;
    public Add(ApexPages.StandardController controller)
        controller.addFields(new List<String>{'Name'}); = (call2__c)controller.getRecord();
        lstpro = [select call__c,,id,quantity__c,products__c,Item__c from Product__c where];
        lstInner = new List<innerClass>();
        selectedRowIndex = '0';
    public String getGreet() {
       return ' (' + + ')';
    public class innerClass
      public String recCount{get;set;}
      public product__c pro {get;set;}
       public innerClass(Integer intCount)
            recCount = String.valueOf(intCount);       
            pro = new product__c();
Hi Mani, 

Need some more information on this issue, 

Is the Call2 field a required field? Is the Call2 Field Blank when you save the Account Record. 

In the visualforce component is the Call2 field updated with some value? 

Did youtry adding some value and saving  the record. 

How is the value being retrived into the component from the Parent record. 

Enable debug logs to understand the flow and to see where the Flow is breaking. 



I could be understanding this incorrectly but could you use Apex:ActionRegion's and save only the Parent or Child record pending the user action?