You need to sign in to do that
Don't have an account?

Record types in managed package in Winter '09
We have a managed package containing a custom object with three record types. Pre-Winter '09 it worked fine; now it won't install in other orgs, and I'm hoping someone can help me understand what has changed.
Symptoms:
1. In the dev org, doing a "Run all Tests" reports 0 failures.
2. If I take the managed package install link to another org and install, I get a bunch of unit test failures like this:
Here's the source code for this test:
3. I thought maybe Winter '09 wanted me to specify a RecordTypeId explicitly, so I tried several variations on this:
Again, the dev org's "Run all Tests" has no problem with this. (That id is a valid record type for the dev org's ENT_2__Support_Program__c object.) But rebuilding the package and attempting an install in any other org gives this error message:
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: id value not valid for the users profile: 012300000009x0GAAQ: [RecordTypeId]
(ENT_2)
Any idea what I am doing wrong?
Symptoms:
1. In the dev org, doing a "Run all Tests" reports 0 failures.
2. If I take the managed package install link to another org and install, I get a bunch of unit test failures like this:
ut_calculations_modelvalidator.SimplestTestCase() | Apex Classes(01p800000008jBO) | System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, record type missing for: Support Program (ENT_2) ; |
---|
Here's the source code for this test:
Code:
static testMethod void SimplestTestCase() { ENT_2__Support_Program__c sp = new ENT_2__Support_Program__c( Name='TestSP', P1__c = 'xyz' ); insert sp; }
Code:
static testMethod void SimplestTestCase() { ENT_2__Support_Program__c sp = new ENT_2__Support_Program__c( Name='TestSP', P1__c = 'xyz' ); sp.RecordTypeId = '012300000009x0G'; insert sp; }
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: id value not valid for the users profile: 012300000009x0GAAQ: [RecordTypeId]
(ENT_2)
Any idea what I am doing wrong?
If you can modify your current solution to be non-ID dependent you can work around this issue while we investigate.
I tried to set the recordTypeId using the method suggested:
However, I get an error indicating: "Method does not exist or incorrect signature: [Schema.DescribeSObjectResult].getRecordTypeInfosByName(String)"
Currently, this is the only thing that is preventing me from installing my package.
Thanks for any help you can provide.
Message Edited by Colin Loretz on 10-27-2008 11:59 AM
Thanks,
Andrew
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@salesforce.com. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.
Thank you again for your patience and assistance. And thanks for using Salesforce!
Error ID: 1536633561-137 (-615805889)
Instead of:
I did used:
The RecordType is created on the installation so no hard coding has been used.