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
Jamz_2010Jamz_2010 

Error when saving parent account

Hi all,

 

I am currently trying to create a new VisualForce page that handles the creation of Accounts and Contacts. I have got the field "Parent Account" which I display by using:

 

 

<apex:inputField value="{!account.Parent}" required="true"/>

 

behind this is the Apex code:

 

 

public Account account { get { return accAccount; } set { accAccount = value; } }

 

 for some reason when I try to save the Account by using:

 

upsert accAccount;

 

 I get the error:

 

 

Error: j_id0:j_id1:j_id3:j_id4:j_id13:j_id16: An error occurred when processing your submitted information.

 

 appear next to the Parent Account field. Does anyone know what might cause this error and how it could be resolved?

 

Thanks

 

James 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Jamz_2010Jamz_2010

Hi again,

 

I have just been doing some testing and it appears that I need to use account.ParentId rather than account.Parent on my VisualForce page. Strange that the error is so unhelpful!

 

Hope this helps anyone else having this problem

 

James