• soni_9999
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Please tell me how to create copy of development instances?

 

Regards,

SS

If I install my managed beta package into a new developer org the installation works fine.

 

If I install, then uninstall and re-install the installation still works fine.

 

But if I install, use "Manage" to create an org instance of a custom setting object, then uninstall and re-install the re-install fails with errors like these:

 

Apex Classes(01pA0000000i0ux) benefitclaimedactionstest.test()
System.DmlException: Insert failed. First exception on row 0;
first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,
cvc.BenefitTrigger: execution of BeforeInsert

caused by: System.DmlException: Upsert failed. First exception on row 0;
first error: DUPLICATE_VALUE, duplicate value found:
SetupOwnerId duplicates value on record with id: 00DA0000000Y0TO: []

 

It appears the unit tests run as part of the install process are failing because of this underlying code (in this one case only):

 

 

public class CustomSettings {
    public static DateConversionFactors__c getDateConversionFactors() {
        if (DateConversionFactors__c.getOrgDefaults() == null) {
            insert new DateConversionFactors__c(SetupOwnerId = UserInfo.getOrganizationId());
        }
        return DateConversionFactors__c.getOrgDefaults();
    }
}

 

My best guess is that the uninstall is not cleaning up the data created when "Manage" was used completely and so the SetupOwnerId inserted here is being seen as a duplicate.

 

Does anyone have any experience of this problem or insight into how to avoid it?

 

Thanks,

Keith