[SalesForce] Managed package install fails in a single customer Org

I'm attempting to install a managed package into a customers sandbox org. This is in existing package that has been installed into a dozen or so other orgs with no issue.

In this particular Sandbox the install starts, but then fails with the message:

Your request to install package "XYZ Package Managed" was unsuccessful. None of the data
or setup information in your salesforce.com organization was affected.

If your install continues to fail, contact Salesforce CRM Support
through your normal channels and provide the following information.

Organization: XYZ, Inc. (00DW00000000000)
User: SomeSandboxUser (005600000000000)
Package: XYZ Package Managed (04t400000000000)
Error Number: 914272613-778 (973378243)

Package Install Failed

An error has occurred during a package install operation.

Thank You, salesforce.com

So the first thing I did was open a Support case with Salesforce.

The response was:

Below is the error detail I see as the cause for package installation failure.

Multiple install problems encountered [null:= 
Invalid type: XyzController: SomeDependantController: Invalid= 
type: XyzController, null: Invalid type: XyzController: Test_XYZ= 
Map: Invalid type: XyzController, null: Invalid type: XyzController: Te= 
st_XYZHelper: Invalid type: XyzController, null: D= 
ependent class is invalid and needs recompilation: 
AB2.SomeDependantController: line 126, column 33: Invalid ty= 
pe: XyzController: Test_SomeDependantController: Dependent cla= 
ss is invalid and needs recompilation:

It appears something went wrong with my XyzController Class in this Org which subsequently broke all the dependant classes.

But why would it only be breaking in this Org and not all the other orgs it has been installed in?

Surely the class must of compiled when the managed package was initially being created.


Another back and forth with Salesforce Support and I'm getting closer. My managed package class isn't compiling due to the error:

No such column FiscalYear on entity Opportunity. If you are attempting
to use a custom field, be sure to append the __c after the custom
field name. Please reference your WSDL or the describe call for the
appropriate names.

Best Answer

FiscalYear might only be available if the organisation has setup fiscal details in their setup - there is definitely some reason that it doesn't exist.

You could test for the existence of the field using the system describe information, then if it does exist reference it via a string (as opposed to using the field name directly in code), thereby making your code tolerant of orgs which do not have this field.

// do not do this
theYear = theOppty.FiscalYear;

// do this
if (fieldExists)
{
  theYear = ((SObject)theOppty).get('FiscalYear');
}
Related Topic