I have some classes that query and use the Quote.BillingAddress aggregate field. This works fine in sandbox (api version 34.0) and running tests against it compile and pass testing.

However, when deploying to production, I get the following error: "Invalid field BillingAddress for SObject Quote". Quote.BillingAddress is accessible from the user that I am deploying as.

I am using ant to deploy. My package xml has a version of 36.0. In addition, even in my deploy script, I have specifically set the apiVersion="36.0". Yet, I still get the error. Any help is greatly appreciated.

Here is the full error message:

TestXXXController. -- line 13, column 65: Dependent class is invalid and needs recompilation:
XXXController: line 410, column 33: Invalid field BillingAddress for SObject Quote
Stack trace: null
  • Did you check the api version in the meta xml file for the class that you are deploying?
    – javanoob
    Mar 31, 2016 at 3:41
  • ... and of any Visualforce that references the field?
    – Keith C
    Mar 31, 2016 at 8:00
  • the api version of the classes are all 34 or 35. I will add the exact error message that it is giving me. It is a compile error on an apex class, not VF page.
    – willard
    Mar 31, 2016 at 13:45
  • 2
    I wonder if it is related to BillingAddress being a compound field. I was under the impression that these were only for the SOAP and REST APIs Source. Can you include the code around line 410 of XXXController. Apr 6, 2016 at 22:16
  • 1
    @DanielBallinger v33.0 exposes this to Apex: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…
    – Eric
    Apr 8, 2016 at 21:42

2 Answers 2


I've had a problem similar to this in the past. To resolve I just used the "Compile all classes" feature within both the Sandbox and Production environments and then retried my ant deployment.

Perform the following steps in your Sandbox and Production environments:

  1. Setup > Build > Develop > Apex Classes
  2. Click the "Compile all classes" link close to the top of the page

Once the above steps are complete, assuming no compilation errors were found, retry your ant script.

  • This is the more complete answer than the answer by Himanshu, so marking this one as the solution.
    – willard
    Apr 10, 2016 at 6:36

1.Try modifying and resaving the class and see if that shows any compile errors. If it does, fix them and retry with ant.

2.Compile all classes.

Hope this helps you.

  • Tried #1 multiple times. No errors. I will try #2.
    – willard
    Apr 10, 2016 at 6:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .