+ Start a Discussion
Surendra123Surendra123 

Error: Compile Error: Invalid field Engineering_Projects__c for SObject TeamMember__c at line 14 column 9

Error: Compile Error: Invalid field Engineering_Projects__c for SObject TeamMember__c at line 14 column 9

Api's

TeamMember__c,  Engineering_Project__c
!
!
!
!
v

TeamRole__c
User__c


public class TeamMemberController {

    public list<TeamMember__c> moreTeamMembers{get;set;}
    ID endProId;
    public TeamMemberController(){
  
        system.debug(apexpages.currentpage().getparameters().get('id'));
        endProId = apexpages.currentpage().getparameters().get('id');
      
        moreTeamMembers = new list<TeamMember__c>();
      
      
        TeamMember__c teamMember = new TeamMember__c();
        teamMember.Engineering_Projects__c = endProId;
        moreTeamMembers.add(teamMember);
      
        TeamMember__c teamMember1 = new TeamMember__c();
        teamMember1.Engineering_Project__c = endProId;
        moreTeamMembers.add(teamMember1);
      
        TeamMember__c teamMember2 = new TeamMember__c();
        teamMember2.Engineering_Project__c = endProId;
        moreTeamMembers.add(teamMember2);
      
        TeamMember__c teamMember3 = new TeamMember__c();
        teamMember3.Engineering_Project__c = endProId;
        moreTeamMembers.add(teamMember3);
      
        TeamMember__c teamMember4 = new TeamMember__c();
        teamMember4.Engineering_Project__c = endProId;
        moreTeamMembers.add(teamMember4);

    }
  
  
    public pagereference mySave()
    {
        for(integer i=0;i<moreTeamMembers.size();i++)
        {
            if(moreTeamMembers[i].User__c != null)
            {
                insert moreTeamMembers[i];
            }
        }
        pagereference pagref = new pagereference('/'+endProId);
        return pagref;
    }
  
    public pagereference myCancel()
    {
       pagereference p = new pagereference('/'+ endProId);
       return p;
  
    }
      

}

page

<apex:page Controller="TeamMemberController" showHeader="false" sidebar="false">  
   <apex:form >
      <apex:pageBlock >
        <apex:pageMessages />
        <apex:pageBlockButtons >
          <apex:commandButton value="Save" action="{!mySave}"/>
          <apex:commandButton value="Save & More" action="{!mySave}"/>
          <apex:commandButton value="Cancel" action="{!myCancel}"/>                    
         </apex:pageBlockButtons>
              <apex:pageBlockTable value="{!moreTeamMembers}" var="TM">
             
              <apex:column headerValue="User">
              <apex:inputField value="{!TM.User__c}"/>
              </apex:column>
             
              <apex:column headerValue="Team Role">
               <apex:inputField value="{!TM.TeamRole__c}"/>
               </apex:column>
             
        </apex:pageBlockTable>
      </apex:pageBlock>
    </apex:form>
  </apex:page>
hitesh90hitesh90
Hi surendra,

check the API Name of "Engineering_Projects__c" this field in "TeamMember__c" object.
There will be two reason of this compilation error.
Either it is not exist in TeamMember__c object or the API Name of this field is different than which you have used.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
My Blog:- http://mrjavascript.blogspot.in/
Surendra123Surendra123
Hi Hitesh,

Thanks for your reply can you please confirm me one thing which Api i need to consider engproj and team mem are 2 custom objs and eng proj and team members have master detail relationshp which api i need to giv please let me know thanks