The below class works on the the hometab to pass the user id to my visualforce page. When i try to add this page to an Account tab in the Console it returns an error that "ID Value 001(the Account id) is not valid for the User standard controller.

How can I pass the user ID? thanks!

Public class UsersNeglectedAccounts      

 public UsersNeglectedAccounts(ApexPages.StandardController controller) {}

 List <AccountTeamMember> ATMS = [select  AccountID from AccountTeamMember 
                                        where UserID =:userinfo.getuserId()];

 Set<Id> accountIds {
   get {
    if (accountIds == null)
        accountIds = new Set<Id>();
        for (AccountTeamMember teamMember : [
            SELECT AccountId FROM AccountTeamMember ETC....

I have another class that when I put it in the Console on an Opportunity it works fine -

public class MyOppsApprovalExt {

  public MyOppsApprovalExt(ApexPages.StandardController controller) {}

  public List <Opportunity> getOppsInApproval (){ 
       return [select Name,  Business_Line__c, Accountid, State__c, Approval_Status__c  
                 from Opportunity where ownerID =:userinfo.getuserId() and 
                                        Approval_Status__c !=ETC CODE...

Am I not using the same methods? thanks

  • what does the VF apex:page ... look like associated with extensions="UsersNeglectedAccounts" ?
    – cropredy
    Jun 17 '15 at 23:38

Your page uses the user standard controller but since you're placing it in the accounts tab, effectively you're passing in an Account ID (which would only work for an Account standard controller).

One solution you can do is query the userID from your accounts table and apply that to your code logic (after creating another page that's similar to your page right now except it will be using the account standard controller).

  • hmm, see my update, aren't these similar ? thanks
    – jaw999
    Jun 17 '15 at 17:49

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.