+ Start a Discussion

System.SObjectException: Invalid field AccountFromId

I have to create an account partner relationship in a unit test. I have written the below. However, it is failing at the bolded line, with the error: System.SObjectException: Invalid field AccountFromId. This is strange, right? The same logic is working in another class, and if I look up the partner object in the workbench 'AccountFromId' is clearly a valid field. Any ideas of what is going wrong? Thanks!

            Account acct = UnitTestFactory.makeAccount();
            Account agencyAcct = UnitTestFactory.makeAccount();
            agencyAcct.Type = 'Agency';
            update agencyAcct;

            Partner pa = new Partner();
            pa.AccountFromId = acct.Id;
            pa.AccountToId = agencyAcct.Id;
            insert pa;

By any chance, do you have a class named "Partner" as well ? if yes, then please rename it.