• aapt.dev
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi
 
I'm trying to mass edit Contacts related to an account but am having problems with saving the changes to the records.
 
My APEX class:
 
public class accountContactList {
    public accountContactList(ApexPages.StandardController controller) {

    }
   
  public Account getAccount() {
    return [select id, name,
             (select id, name, firstName, lastName, title, phone, mobilePhone, email from Contacts limit 5)
             from Account where id =
             :ApexPages.currentPage().getParameters().get('Id') ];
}

public String getName() {
  return 'Account Contact List';
  }
 
  public PageReference save() {
        return null;
    }
}
 
My VF page:
 
<apex:page standardController="Contact" extensions="accountContactList" id="thePage"
 <apex:pageBlock title="Mass Edit Contacts">
 </apex:pageBlock>
 <apex:form >
  <apex:pageBlock >
   <apex:pageMessages /> 
    <apex:pageBlockButtons >
     <apex:commandButton action="{!save}" value="Save" id="theButton"/>
    </apex:pageBlockButtons>
    <apex:pageBlockTable value="{!account.Contacts}"
                         var="contact">

   <apex:column value="{!contact.name}" width="25" />
      <apex:column headerValue="Title" width="100">
      <apex:inputField value="{!contact.title}"/>
     </apex:column>
          <apex:column headerValue="Phone" width="15">
      <apex:inputField value="{!contact.phone}"/>
     </apex:column>
     <apex:column headerValue="Mobile" width="15">
      <apex:inputField value="{!contact.mobilephone}"/>
     </apex:column>
     <apex:column headerValue="E-Mail" width="25">
      <apex:inputField value="{!contact.email}"/>
     </apex:column>

         </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
 </apex:page>
 
I am getting the following error message:
 
Id value 0018000000Mif1y is not valid for the Contact standard controller (the ID being that of the account)
 
Any guidance would be much apprecaited from this newbie
 
Thanks in advance
Hi
 
I'm an advanced administrator but have absolutely no coding skills and am trying to teach myself some basic APEX and VisualForce.
I am having some difficulty understanding standard controller extensions and was hoping that someone can give me a little guidance here. I have scoured the discussion boards but have failed miserably in locating a post that I could understand so apologies in advance if this is a topic that has already been dealt with.
 
I'm trying to build a VF page that will allow users to mass update the Contacts on an Account e.g. phone numbers, flag as inactive etc.
 
My code:
 
public class accountContactList {
    public PageReference save() {
        return null;
    }

  public Account getAccount() {
    return [select id, name,
             (select id, name, firstName, lastName, title, phone, mobilePhone, email from Contacts limit 5)
             from Account where id =
             :ApexPages.currentPage().getParameters().get('Id') ];
}

public String getName() {
  return 'Account Contact List';
  }
}
 
My VF page:
<apex:page controller="accountContactList" tabStyle="Contact">


<apex:pageBlock title="Mass Edit Contacts">

</apex:pageBlock>

<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" id="theButton"/>

</apex:pageBlockButtons>

<apex:pageBlockTable value="{!account.Contacts}"
var="contact">

<apex:column value="{!contact.name}" width="25" />
<apex:column headerValue="Title" width="100">
<apex:inputField value="{!contact.title}"/>
</apex:column>
<apex:column headerValue="Phone" width="15">
<apex:inputField value="{!contact.phone}"/>
</apex:column>
<apex:column headerValue="Mobile" width="15">
<apex:inputField value="{!contact.mobilephone}"/>
</apex:column>
<apex:column headerValue="E-Mail" width="25">
<apex:inputField value="{!contact.email}"/>
</apex:column>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>

</apex:page>
The above allows me to access and edit the Account's related Contact records but I am unable to save any changes I make
I have tried adding:
private final ApexPages.standardController the Controller
and
return theController.save();
to the Apex Class but without much success (as described in on p391 of the force.com Developer Guide that I picked up at Dreamforce '08)
Any help/guidance would be most appreciated.
Thanks in advance
Hi
 
I'm an advanced administrator but have absolutely no coding skills and am trying to teach myself some basic APEX and VisualForce.
I am having some difficulty understanding standard controller extensions and was hoping that someone can give me a little guidance here. I have scoured the discussion boards but have failed miserably in locating a post that I could understand so apologies in advance if this is a topic that has already been dealt with.
 
I'm trying to build a VF page that will allow users to mass update the Contacts on an Account e.g. phone numbers, flag as inactive etc.
 
My code:
 
public class accountContactList {
    public PageReference save() {
        return null;
    }

  public Account getAccount() {
    return [select id, name,
             (select id, name, firstName, lastName, title, phone, mobilePhone, email from Contacts limit 5)
             from Account where id =
             :ApexPages.currentPage().getParameters().get('Id') ];
}

public String getName() {
  return 'Account Contact List';
  }
}
 
My VF page:
<apex:page controller="accountContactList" tabStyle="Contact">


<apex:pageBlock title="Mass Edit Contacts">

</apex:pageBlock>

<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" id="theButton"/>

</apex:pageBlockButtons>

<apex:pageBlockTable value="{!account.Contacts}"
var="contact">

<apex:column value="{!contact.name}" width="25" />
<apex:column headerValue="Title" width="100">
<apex:inputField value="{!contact.title}"/>
</apex:column>
<apex:column headerValue="Phone" width="15">
<apex:inputField value="{!contact.phone}"/>
</apex:column>
<apex:column headerValue="Mobile" width="15">
<apex:inputField value="{!contact.mobilephone}"/>
</apex:column>
<apex:column headerValue="E-Mail" width="25">
<apex:inputField value="{!contact.email}"/>
</apex:column>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>

</apex:page>
The above allows me to access and edit the Account's related Contact records but I am unable to save any changes I make
I have tried adding:
private final ApexPages.standardController the Controller
and
return theController.save();
to the Apex Class but without much success (as described in on p391 of the force.com Developer Guide that I picked up at Dreamforce '08)
Any help/guidance would be most appreciated.
Thanks in advance