3

actually i have 2 objects with parent and child reletion ship....and those objects are "EntityRelation__c"(child object).....and another is "Entity master__c"(parent object)....now i have a requirement like i have to populate "entity maser"fields on my vf page of entity reletion__c that also i need like in edit mode.. so for this i wrote the code like

<apex:page standardController="EntityRelation__c" extensions="entityex" sidebar="false"  showHeader="true" >

<apex:form id="theform">

<apex:pageBlock title="Entity Detail">
<apex:pageBlockButtons >
<apex:commandButton value="save"  action="{!save}"/>
<apex:commandButton value="save&new" action="{!save}"/>
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageBlockButtons>`
<apex:pageBlockSection title="Entry No" columns="2">
<apex:actionfunction name="nameChanged" action="nameChanged" rerender="theform"/>
<apex:inputField value="{!EntityRelation__c.Entity_Name__c}" required="true" id="entity_id" onchange="nameChanged()">
<apex:actionSupport event="onchange" reRender="salesRepDetails" />
</apex:inputField>
<apex:inputField value="{!EntityMaster__c.Company_Code__c}" required="true"/>
<apex:inputField value="{!EntityMaster__c.Ven_CusNo__c}" required="true"/>
<apex:inputField value="{!EntityMaster__c.GL_Account__c}" required="true"/>
</apex:pageBlockSection>
</apex:pageBlock>ge
</apex:form>

My controller code is the following:

public with sharing class entityex {
public EntityMaster__c emObject{get;set;}
public EntityRelation__c erObject{get;set;}

public entityex (ApexPages.StandardController controller)
{
   this.erObject = (EntityRelation__c)controller.getrecord();
}
public void nameChanged()
{
    this.emObject = [Select Id,Name,Ven_CusNo__c,GL_Account__c,Company_Code__c from    EntityMaster__c Where id = :erObject.Entity_Name__c];

}
}

but am getting error like

" Unknown property 'EntityRelation__cStandardController.EntityMaster__c'"

What does that error mean?

I want to auto populate the four fields on the entity master (parent object) when I select "{!EntityRelation__c.Entity_Name__c}". This is the lookup field to the parent object.

THE ABOVE FOUR FILEDS ALSO THERE ON THE "ENTITY MASTER"(PARENT OBJECT).....NOW I WANT TO AUTO POPULATE THOSE FIELD WHEN I ONLY SELECT "{!EntityRelation__c.Entity_Name__c}" ...ITS LOOK UP FIELD TO PARENT OBJECT

4

Is it just a typo, or does your code actually have

Entity_Master_c
EntityRelation_c

If thats what it really is in the code, you are missing another underscore

Entity_Master__c
EntityRelation__c

This typo would cause you to get the unknown property error as well

  • I see the answer was edited, but not by you. Were those just typos (Entity_Master_c instead of Entity_Master__c), or is that how your code actually reads, because that would be causing the errors – Chris Duncombe Oct 9 '13 at 15:46
  • i just formatted the code :) – Jag Oct 9 '13 at 15:48
  • Not true, if you look at the original post, the controller properties have a single underscore, now they have 2 (the correct syntax), but the question is which way the actual code he is running reads. This is especially important as it seems his error message references the single underscore syntax of the controller property. I'm not saying you did anything wrong, no worries there, just trying to get to the bottom of it – Chris Duncombe Oct 9 '13 at 15:49
  • The specific reason for the error message is that <apex:inputField value="{!EntityMaster__c.Company_Code__c}" required="true"/> is interpreted by the VF compiler as looking for custom field Entity_Master__c on the SObject EntityRelation__c. But your intent is to refer to a different SObject. This needs to be done as a reference to a controller property on an instantiated Entity_Master__c object like emObject – cropredy Oct 9 '13 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.