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
Rogerio Lara 2028Rogerio Lara 2028 

Visualforce page: Error: Unknown property 'Opportunity_Positioning__cStandardController.Buying_Influence__c'

Hi everyone,

I'm getting  -Error: Unknown property 'Opportunity_Positioning__cStandardController.Buying_Influence__c'? 

Any ideas what  I am doing wrong? Your assistance would be much appreciated!

Thank you,

Rog

<apex:page standardcontroller="Opportunity_Positioning__c">
           extensions="EditableBuyingInfluenceExtension"
<apex:sectionheader title="{!$ObjectType.Buying_Influence__c.label} Edit" subtitle="{!IF(ISNULL(Buying_Influence__c.Name), 'New Buying Influence',Buying_Influence__c.Name)}"/>
    <apex:form >
        <apex:pageblock mode="edit" title="{!$ObjectType.Buying_Influence__c.label} Edit">
            <apex:pageblockbuttons >
                <apex:commandbutton value="Save" action="{!Save}"/>
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
            </apex:pageblockbuttons>
            <apex:pageblocksection title="Information" showheader="true" columns="2">
                    <apex:outputText> value="{!Opportunity_Positioning__c.Name}"/>
                    <apex:outputText> value="{!Opportunity_Positioning__c.Opportunity__c}"/>
                    <apex:pageblocksectionitem />
            <apex:pageBlockSectionItem >
                <apex:pageblocksection id="childList" columns="1" title="Buying Influence" collapsible="false">
                <apex:variable var="rowNum" value="{!ZERO}" />
                <apex:outputLabel value="No Buying Influence currently exist. Click below to Add." rendered="{!NOT(hasChildren)}"/>
                    <apex:pageBlockTable value="{!children}" var="Buying Influence" rendered="{!hasChildren}">
                    <apex:column headerValue= "Buying Influence">
                    <apex:inputfield value="{!Buying_Influence__c.Name}" required="true"/>
                    <apex:column headerValue= "SCOP">
                    <apex:inputfield value="{!Buying_Influence__c.SCOP__c}" required="true"/>
                    <apex:column headerValue= "Influencer Name">
                    <apex:inputfield value="{!Buying_Influence__c.Influencer_Name__c}" required="true"/>
                    <apex:column headerValue= "Buying Influence role">
                    <apex:inputfield value="{!Buying_Influence__c.Buying_influence_role__c}" required="true"/>
                    <apex:column headerValue= "Degree of Influence">
                    <apex:inputfield value="{!Buying_Influence__c.Degree_of_Influence__c}" required="true"/>
                    <apex:pageblocksectionitem />
               </apex:column>
               <apex:pageblocksection title="How well is based covered for this contact" showheader="true" columns="2">
               </apex:pageblocksection>
               </apex:column> headerValue="Rating for base covered">
                    <apex:inputfield value="{!Buying_Influence__c.Rating_for_base_covered__c}" required="true"/>
               </apex:column> headerValue="Equivalent Collinson Stakeholder">
                    <apex:inputfield value="{!Buying_Influence__c.Equivalent_Collinson_Stakeholder__c}" required="false"/>
               </apex:column> headerValue="Evidence to support your rating">
                    <apex:inputfield value="{!Buying_Influence__c.Evidence_to_support_your_rating__c}" required="false"/>
                    </apex:column>
                    <apex:column headerValue=" ">
                    <!-- This is the second half of the trick to keep track
                    of your row index for deletion. -->
                    <apex:variable var="rowNum" value="{!rowNum + 1}" />
                    <apex:commandLink value="Delete" action="{!removeFromList}" rerender="childList,messages" immediate="true"> 
     <apex:param name="removeIndex" assignTo="{!removeIndex}" value="{!rowNum}" />
            </apex:commandLink>
          </apex:column>
        </apex:pageBlockTable>
        <apex:commandButton value="Add Buying Influence" action="{!addToList}" rerender="childList, messages" immediate="true" />
      </apex:pageBlockSection>
     </apex:pageblocksectionitem>
     </apex:outputtext> </apex:outputtext>
    </apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>
Best Answer chosen by Rogerio Lara 2028
Dilip_VDilip_V
Rog,

try this
 
public class addOpportunityPositioningExt{
   
   public Opportunity_Positioning__c dem {get; set;}


   public addOpportunityPositioningExt(ApexPages.StandardController stdController) {

        dem= (Opportunity_Positioning__c)stdController.getRecord();
    }


    public PageReference saveDem(){
        try{
              upsert dem;
              PageReference pageRef = new PageReference('/apex/addBuyingInfluences?id=' + dem.Id + '&retUrl=' + dem.Id);
              pageRef.setRedirect(true);
              return pageRef;

        }catch(DMLException saveEx){
             //handle exception
return null;
    }
return null;
}
}

Thanks
 

All Answers

Dilip_VDilip_V
Rog,

You are refering Buying_Influence__c in VF page.But it is not a standard controller and possibly not declared in extension.Thats why you are getting that error.


Thanks.
Rogerio Lara 2028Rogerio Lara 2028
Hi there, thank you. I haven’t created an Extension yet. Let me try this. Thank you, Rog
Dilip_VDilip_V
Glad it helped.

Mark it as solved rog.

Thanks​
Rogerio Lara 2028Rogerio Lara 2028
Hi Thermo,

I'm still getting stuck. 

Now I am getting this error message when creating on of the classes: Error: Compile Error: Non-void method might not return a value or might have statement after a return statement. at line 19 column 36

public class addOpportunityPositioningExt{
   
   public Opportunity_Positioning__c dem {get; set;}


   public addOpportunityPositioningExt(ApexPages.StandardController stdController) {

        dem= (Opportunity_Positioning__c)stdController.getRecord();
    }


    public PageReference saveDem(){
        try{
              upsert dem;
              PageReference pageRef = new PageReference('/apex/addBuyingInfluences?id=' + dem.Id + '&retUrl=' + dem.Id);
              pageRef.setRedirect(true);
              return pageRef;

        }catch(DMLException saveEx){
             //handle exception

    }
}
}
Dilip_VDilip_V
Rog,

try this
 
public class addOpportunityPositioningExt{
   
   public Opportunity_Positioning__c dem {get; set;}


   public addOpportunityPositioningExt(ApexPages.StandardController stdController) {

        dem= (Opportunity_Positioning__c)stdController.getRecord();
    }


    public PageReference saveDem(){
        try{
              upsert dem;
              PageReference pageRef = new PageReference('/apex/addBuyingInfluences?id=' + dem.Id + '&retUrl=' + dem.Id);
              pageRef.setRedirect(true);
              return pageRef;

        }catch(DMLException saveEx){
             //handle exception
return null;
    }
return null;
}
}

Thanks
 
This was selected as the best answer
Rogerio Lara 2028Rogerio Lara 2028
Hi Thermo,

Thank you so much! It looks like it's working. 

If you don't mind could you help me identify what's wrong with this one: 


Error: Compile Error: Didn't understand relationship 'Buying_Influence__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 11 column 19

public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Quota__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,
                              Name,
                               Buying_Influence__r.Name
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Buying_Influence__c.Name,
                          Buying_Influence__c.SCOP__c,
                          Buying_Influence__c.Influencer_Name__c,
                          Buying_Influence__c.Buying_influence_role__c,
                          Buying_Influence__c.Degree_of_Influence__c,
                          Buying_Influence__c.Rating_for_base_covered__c,
                          Buying_Influence__c.Equivalent_Collinson_Stakeholder__c
                          Buying_Influence__c.Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Quota__c> getChildren()
  {
    return (List<Quota__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}
Dilip_VDilip_V
Rog,

Buying_Influence__c is child to Opportunity_Positioning__c or parent?
if it is child Opportunity_Positioning__c modify your query like this
this.mydemo = [SELECT Id,
                              Name, ( select id,name from  Buying_Influence__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];

Let me know if you have any issues.

Thanks.
Rogerio Lara 2028Rogerio Lara 2028
The Buying Influence is a child of the Opportunity Positioning. These are both custom objects. The reason I am trying to use visualforce and override the standard new/edit Opportunity Positioning, is because one Opportunity Positioning must have 2 or more Buying Influences associated with and they must be added at once on edit page, rather than the standard related list functionality that can only add one at the time. I need to save the Opportunity Positioning and immediately be taken to the addBuying Influences page as if they had clicked the button on the detail page. Thank you ever so much. Rog
Rogerio Lara 2028Rogerio Lara 2028
Now I am getting 
Error: Compile Error: Didn't understand relationship 'Buying_Influence__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 11 column 19
Rogerio Lara 2028Rogerio Lara 2028
Buying Influence Controller

public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Quota__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

this.mydemo = [SELECT Id,
                              Name, ( select id,name from  Buying_Influence__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c
                          Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Quota__c> getChildren()
  {
    return (List<Quota__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}

Buying Influence Page 
 
<apex:page standardcontroller="Opportunity_Positioning__c">
           extensions="EditableBuyingInfluenceExtension"
<apex:sectionheader title="{!$ObjectType.Buying_Influence__c.label} Edit" subtitle="{!IF(ISNULL(Buying_Influence__c.Name), 'New Buying Influence',Buying_Influence__c.Name)}"/>
    <apex:form >
        <apex:pageblock mode="edit" title="{!$ObjectType.Buying_Influence__c.label} Edit">
            <apex:pageblockbuttons >
                <apex:commandbutton value="Save" action="{!Save}"/>
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
            </apex:pageblockbuttons>
            <apex:pageblocksection title="Information" showheader="true" columns="2">
                    <apex:outputText> value="{!Opportunity_Positioning__c.Name}"/>
                    <apex:outputText> value="{!Opportunity_Positioning__c.Opportunity__c}"/>
                    <apex:pageblocksectionitem />
            <apex:pageBlockSectionItem >
                <apex:pageblocksection id="childList" columns="1" title="Buying Influence" collapsible="false">
                <apex:variable var="rowNum" value="{!ZERO}" />
                <apex:outputLabel value="No Buying Influence currently exist. Click below to Add." rendered="{!NOT(hasChildren)}"/>
                    <apex:pageBlockTable value="{!children}" var="Buying Influence" rendered="{!hasChildren}">
                    <apex:column headerValue= "Buying Influence">
                    <apex:inputfield value="{!Buying_Influence__c.Name}" required="true"/>
                    <apex:column headerValue= "SCOP">
                    <apex:inputfield value="{!Buying_Influence__c.SCOP__c}" required="true"/>
                    <apex:column headerValue= "Influencer Name">
                    <apex:inputfield value="{!Buying_Influence__c.Influencer_Name__c}" required="true"/>
                    <apex:column headerValue= "Buying Influence role">
                    <apex:inputfield value="{!Buying_Influence__c.Buying_influence_role__c}" required="true"/>
                    <apex:column headerValue= "Degree of Influence">
                    <apex:inputfield value="{!Buying_Influence__c.Degree_of_Influence__c}" required="true"/>
                    <apex:pageblocksectionitem />
               </apex:column>
               <apex:pageblocksection title="How well is based covered for this contact" showheader="true" columns="2">
               </apex:pageblocksection>
               </apex:column> headerValue="Rating for base covered">
                    <apex:inputfield value="{!Buying_Influence__c.Rating_for_base_covered__c}" required="true"/>
               </apex:column> headerValue="Equivalent Collinson Stakeholder">
                    <apex:inputfield value="{!Buying_Influence__c.Equivalent_Collinson_Stakeholder__c}" required="false"/>
               </apex:column> headerValue="Evidence to support your rating">
                    <apex:inputfield value="{!Buying_Influence__c.Evidence_to_support_your_rating__c}" required="false"/>
                    </apex:column>
                    <apex:column headerValue=" ">
                    <!-- This is the second half of the trick to keep track
                    of your row index for deletion. -->
                    <apex:variable var="rowNum" value="{!rowNum + 1}" />
                    <apex:commandLink value="Delete" action="{!removeFromList}" rerender="childList,messages" immediate="true"> 
     <apex:param name="removeIndex" assignTo="{!removeIndex}" value="{!rowNum}" />
            </apex:commandLink>
          </apex:column>
        </apex:pageBlockTable>
        <apex:commandButton value="Add Buying Influence" action="{!addToList}" rerender="childList, messages" immediate="true" />
      </apex:pageBlockSection>
     </apex:pageblocksectionitem>
     </apex:outputtext> </apex:outputtext>
    </apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>


 
Dilip_VDilip_V
Rog,

Please try this code.
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Quota__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  Buying_Influence__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Buying_Influence__c.Name,
                          Buying_Influence__c.SCOP__c,
                          Buying_Influence__c.Influencer_Name__c,
                          Buying_Influence__c.Buying_influence_role__c,
                          Buying_Influence__c.Degree_of_Influence__c,
                          Buying_Influence__c.Rating_for_base_covered__c,
                          Buying_Influence__c.Equivalent_Collinson_Stakeholder__c
                          Buying_Influence__c.Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Quota__c> getChildren()
  {
    return (List<Quota__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}
If this didn't work please share previous copy of your code and snapshot of Buying_Influence__c field(Look up field info) definition.

Thanks.
 
Rogerio Lara 2028Rogerio Lara 2028
These are the Buying Influence fields
Account nameAccount_name__c  Formula (Text)    
Business TitleBusiness_Title__cFormula (Text)   
Replace Buying influence roleBuying_influence_role__c   Picklist   
Replace Degree of InfluenceDegree_of_Influence__c       Picklist  
Equivalent Collinson StakeholderEquivalent_Collinson_Stakeholder__c     Lookup(User)  
Evidence to support your ratingEvidence_to_support_your_rating__c        Rich Text Area(300)  
Influencer NameInfluencer_Name__cLookup(Contact) 
name compositionname_composition__cFormula (Text)   
Replace Rating for base coveredRating_for_base_covered__c    Picklist 
SCOPSCOP__cMaster-Detail(Strategic Client Opportunity Plan)

 
Rogerio Lara 2028Rogerio Lara 2028
Updated controller 

Error: Compile Error: Didn't understand relationship 'Buying_Influence__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 11 column 19
 
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Buying_Influence__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  Buying_Influence__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c
                          Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Buying_Influence__c> getChildren()
  {
    return (List<Buying_Influence__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}

 
Dilip_VDilip_V
Rog,

I want the relationship field which connects Buying_Influence__C and Opportunity_Positioning__c.If there is no relationship between these two objects create lookup or master-detail based on your requirement on Buying_Influence__C.

Thanks.
Rogerio Lara 2028Rogerio Lara 2028
Sorry. I see what you mean. The lookup field on the Buying Influence is called SCOP__c . It has Master-Detail(Strategic Client Opportunity Plan).
Dilip_VDilip_V
Rog,

Try this once then
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Buying_Influence__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  SCOP__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c
                          Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Buying_Influence__c> getChildren()
  {
    return (List<Buying_Influence__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}

Thanks.
Rogerio Lara 2028Rogerio Lara 2028
So sorry. For some reason still doesn’t recognise the relationship. [Description: Error] Error: Compile Error: Didn't understand relationship 'SCOP__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 11 column 19
Rogerio Lara 2028Rogerio Lara 2028
Not sure if this information  helps.

Opportunity Positioning
Singular Label:         Strategic Client Opportunity 
Plural Label:              SCOP
Object Name:             Opportunity_Positioning
API Name:                  Opportunity_Positioning__c


Buying Influence

Singular Label;             Buying Influence
Plural Label;                 Buying Influences
Object Name;               Buying_Influence
API Name;                   Buying_Influence__c
Dilip_VDilip_V
Rog,

Share screenshot of The lookup field on the Buying Influence is called SCOP__c.
Create->Objects->Buying_Influence__c
under Buying_Influence__c click on field called SCOP__C and share that screen shot here.

Please refer to this link you will get to know how to use the relationship names in SOQL query.
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_and_custom_objects.htm#sforce_api_calls_soql_relationships_and_custom_objects


Thanks.
Dilip_VDilip_V
One more
http://www.sfdc99.com/2013/06/24/example-how-to-write-a-cross-object-soql-query-part-2/
Rogerio Lara 2028Rogerio Lara 2028
User-added image
Dilip_VDilip_V
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Buying_Influence__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  Buying_Influences__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c
                          Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Buying_Influence__c> getChildren()
  {
    return (List<Buying_Influence__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}
Let me know if you have any issues.

Thanks.
Rogerio Lara 2028Rogerio Lara 2028
Hi Dilip, really appreciate you help with this. I think we are almost there now. I got this message: Error: Compile Error: only aggregate expressions use field aliasing at line 15 column 22 I’m also trying from my end, but probably with less success than you. Thank you for helping me. Rog
Rogerio Lara 2028Rogerio Lara 2028
It looks like it was just commas missing, but now I am getting this message
Error: Compile Error: unexpected token: 'FROM' at line 25 column 22
 
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Buying_Influence__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  Buying_Influences__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c,
                          Evidence_to_support_your_rating__c,
                          
                      FROM Buying_Influence__c;
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Buying_Influence__c> getChildren()
  {
    return (List<Buying_Influence__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}

 
Dilip_VDilip_V
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Buying_Influence__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  Buying_Influences__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c,
                          Evidence_to_support_your_rating__c,
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Buying_Influence__c> getChildren()
  {
    return (List<Buying_Influence__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}

 
Rogerio Lara 2028Rogerio Lara 2028
I can't see why this wouldn't work. I am getting this message: Error: Compile Error: unexpected token: 'FROM' at line 25 column 22
So sorry. ;-(
Dilip_VDilip_V
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Buying_Influence__c> children {get; set;}
  public EditableBuyingInfluenceListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  Buying_Influences__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c,
                          Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Buying_Influence__c> getChildren()
  {
    return (List<Buying_Influence__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}

no Problem.Try above code.

Thanks.
Rogerio Lara 2028Rogerio Lara 2028
Almost there I think. Now I’ve got Error: Compile Error: Invalid constructor name: EditableBuyingInfluenceListExtension at line 7 column 10
Dilip_VDilip_V
public with sharing class EditableBuyingInfluenceExtension extends EditableBuyingInfluenceList
{


 public Opportunity_Positioning__c mydemo {get; private set;}
 public List<Buying_Influence__c> children {get; set;}
  public EditableBuyingInfluenceExtension (ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,Name, ( select id,name from  Buying_Influences__r)
                            FROM Opportunity_Positioning__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Name,
                          SCOP__c,
                          Influencer_Name__c,
                          Buying_influence_role__c,
                          Degree_of_Influence__c,
                          Rating_for_base_covered__c,
                          Equivalent_Collinson_Stakeholder__c,
                          Evidence_to_support_your_rating__c
                          
                      FROM Buying_Influence__c
                      WHERE Opportunity_Positioning__c =: mysObject.Id];

     children = new List<Buying_Influence__c>();
     children.addALL(this.childList);
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  /*public List<Buying_Influence__c> getChildren()
  {
    return (List<Buying_Influence__c>)childList;
  }*/

  public PageReference saveChildren(){

      try{
           upsert children;
           //use the redirect method like the demographic page if needed after upsert
      }catch(DMLException saveEx){
         //do something
       }

       return null;
   }


  public override sObject initChildRecord()
  {
    Buying_Influence__c child = new Buying_Influence__c();
    child.Opportunity_Positioning__c = mydemo.Id;
   
    
    return child;
  }
}

Solved.