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
Mark Thomas 49Mark Thomas 49 

Add Account Owner in existing Apex Class

We have an existing Apex Class that syncs information between Salesforce and our ERP system. We would like to start pulling the Account Owner from Salesforce. I'm getting an error when adding Account Owner to this string in the existing APEX class,    

this.SalesforceID = account.Id;
            this.Name = account.Name;
            this.PrimaryCountry = account.Primary_Country__c;
            //this.EAGRelationshipID = EAGRelationshipID; //no related field in salesforce
            this.UnicodeName = account.Account_Name_Unicode__c;
            this.IndustrySectorID = account.Industry_Sector_ID__c;
            this.ManufacturingTypeID   =account.Manufacturing_Type_ID__c;
            this.[Select Id, Name ,OwnerId from Account where id in : relatedAccountId]){
        }

Any thoughts about how I might structure this?
AnudeepAnudeep (Salesforce Developers) 
Hi Mark, 

Can you try using account.ownerId = 'ID' format instead? 

Anudeep
Mark Thomas 49Mark Thomas 49
That didn't seem to change the error.  This is the error:
Error: Compile Error: Missing ';' at '[' at line 481 column 18

I know the Owner field is handled differently because it is being pulled from the user object, but I'm not having any luck pulling it into this Apex Class