I'm building a batch job to import a lot of accounts where I only set all the basic properties. No problems here.
I run thru all my accounts to check if there are some that should have an OpeningAccount set, which there are and that is my problem.
Here is my code: (rewritten as it comes from different methods)
IAccountData updateAccount = AccountImportProcessLineBasic(inputLine); //Build the AccountData with basic properties set
if (inputLine[accountImportOpeningAccountMapping] != ) //Check if this account needs an openingAccount
int contraAccountNumer = Convert.ToInt32(inputLine[accountImportOpeningAccountMapping]); //Get the account number
IAccount openingAccount = session.Account.FindByNumber(contraAccountNumer); //Get Account from Economic by account number
if (openingAccount != null)
updateAccount.OpeningAccount = openingAccount; //If I actually find an account set the property (I'll allways find the account as I started with creating all my accounts)
if (updateAccount.OpeningAccount != null)
session.Account.UpdateFromData(updateAccount); //Updating Account on server fails
outputLog.AppendLine( Updated Opening Account on Number: + updateAccount.Number.ToString() + - Name: + updateAccount.Name + - Type: + updateAccount.Type.ToString());
Initially I would have used session to get the Account from Economic, performed the update on the object and then submitted the change by using session.Account.update(..) that is not possible because there are no methods to do this. The only way is to do it by using AccountData, but AccountData are not mapped/have a corresponding entity, so what should I do?
I properly have missed a thing but what is it?
Kindly regards Rasmus