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
ckellieckellie 

Error Testing

What does the following error mean? I am testing my first project and am getting the following error onm the "Account Name" field.

 

Error: j_id0:j_id2:j_id3:j_id11:j_id12: An error occurred when processing your submitted information.
Thank you
Best Answer chosen by Admin (Salesforce Developers) 
CarcajouCarcajou

Hi,

 

i finally found the issue. This is something i am not fully clear with Salesforce.

In fact this kind of error means there is a mimatching data type between the page and the controller.

In the page you use Opportunity.Account and salesforce tries to fetch this with the Account field of the opportunity. But the Account field is just an Id and not the full account object and the name of the relation between Opportunity and Account is "Account" whereas the name of the field storing the data in the opportunity is AccountId.

 

I am not sure what i say is very clear. If some one has a better way to explain that would be great :-)

 

Anyway, in your page if you replace "{!Opportunity.Account}" by "{!Opportunity.AccountId}", it should work.

 

Kind Regards,

Catherin.

All Answers

CarcajouCarcajou

Hi,

 

I think the code is needed in order to make some analysis. 

 

Kind Regards, 

Catherin. 

ckellieckellie
I have been testing more and found the problem had to do with custom controllers with the same name as the standard controllers. Thank you
ckellieckellie

The problem returned and here is the code for the page.

 

<apex:page controller="newOpportunity1Controller" tabStyle="New_Customer__tab" sidebar="false">
  <apex:sectionHeader title="New Customer Opportunity" subtitle="Step 1 of 2"/>
      <apex:form >
      <apex:pageBlock title="Customer Information" mode="edit">
        Below is minimum required information to create a new opportunity. In the account section, Please click the lookup icon to
        pick the existing customer or to create a new customer. Then there is five (5) fields required to create a new opportunity.
        The Stage will automatically set to Prospecting and Qualifying. After the completion of these fields, the second optional step is to add
        essential information about the company and opportunity.
        <apex:pageBlockButtons >
          <apex:commandButton action="{!step2}" value="Enter More Information"/>
          <apex:commandButton action="{!step3}" value="Confirm"/>
               </apex:pageBlockButtons>
     
      <apex:pageBlockSection title="Required Account Information" columns="1">
      <apex:inputHidden /><apex:inputHidden />
      </apex:pageBlockSection>
      <apex:pageBlockSection >
      <apex:inputField value="{!Opportunity.Account}" required="true"/>
     </apex:pageBlocksection>
     <apex:pageBlockSection title="Basic Contact Information" columns="2">
      <apex:inputField value="{!Contact.FirstName}" required="false"/>
      <apex:inputField value="{!Contact.LastName}"  required="false"/>
      <apex:inputField value="{!Contact.Email}"/>
      <apex:inputField value="{!Contact.Phone}"/>
      <apex:inputField value="{!Contact.HasOptedOutOfEmail}"/>     
     </apex:pageBlockSection>    
     <apex:pageBlockSection title="Required Opportunity Information">
      <apex:inputField value="{!Opportunity.Name}" required="true"/>
      <apex:inputField value="{!Opportunity.CurrencyIsoCode}" required="true"/>
      <apex:inputField value="{!Opportunity.CloseDate}" required="true"/>
      <apex:inputField value="{!Opportunity.Amount}" required="true"/>
      <apex:inputHidden />
      <apex:inputField value="{!Opportunity.Equip_Services_Options_to_be_quoted__c}" required="true"/>
     
           </apex:pageBlockSection>         
         </apex:pageBlock>
  </apex:form>

</apex:page>

 

and Here is the Controller

 

public class newOpportunity1Controller {
    public PageReference opptystep3() {
        return null;
    }


    public PageReference edit() {
        return null;
    }


    public PageReference opptystep2() {
        return null;
    }


    public PageReference opptystep1() {
        return null;
    }

 


    public PageReference save() {
        return null;
    }


    public String Account { get; set; }

    public String ManufacturingDesignSheet { get; set; }

    public PageReference step1() {
        return Page.opptyStep1;
    }

 

   // These four member variables maintain the state of the wizard.
   // When users enter data into the wizard, their input is stored
   // in these variables.
  
  
   Contact contact;
   Opportunity opportunity;
   OpportunityContactRole role;


   // The next four methods return one of each of the four member
   // variables. If this is the first time the method is called,
   // it creates an empty record for the variable.
   public Contact getContact() {
      if(contact == null) contact = new Contact();
      return contact;
   }

   public Opportunity getOpportunity() {
      if(opportunity == null) opportunity = new Opportunity();
      return opportunity;
   }

   public OpportunityContactRole getRole() {
      if(role == null) role = new OpportunityContactRole();
      return role;
   }
  
   // The next three methods control navigation through
   // the wizard. Each returns a PageReference for one of the three pages
   // in the wizard. Note that the redirect attribute does not need to
   // be set on the PageReference because the URL does not need to change
   // when users move from page to page.
   public PageReference ste1() {
      return Page.opptyStep1;
   }

   public PageReference step2() {
      return Page.opptyStep2;
   }

   public PageReference step3() {
      return Page.opptyStep3;
   }

   // This method performs the final save for all four objects, and
   // then navigates the user to the detail page for the new
   // opportunity.


}

CarcajouCarcajou

Hi,

 

i finally found the issue. This is something i am not fully clear with Salesforce.

In fact this kind of error means there is a mimatching data type between the page and the controller.

In the page you use Opportunity.Account and salesforce tries to fetch this with the Account field of the opportunity. But the Account field is just an Id and not the full account object and the name of the relation between Opportunity and Account is "Account" whereas the name of the field storing the data in the opportunity is AccountId.

 

I am not sure what i say is very clear. If some one has a better way to explain that would be great :-)

 

Anyway, in your page if you replace "{!Opportunity.Account}" by "{!Opportunity.AccountId}", it should work.

 

Kind Regards,

Catherin.

This was selected as the best answer
Srinivas_V2Srinivas_V2

Yes. Account is just a label for the opportunity's account field. as the API Name is AccountId which you will get to see in the object's schema. we have to use it inthat way.

 

ckellieckellie
Thank you both. This worked perfectly.