+ Start a Discussion
prashant1985prashant1985 

Error when installing package on client sandbox

Hi,

 

I have make pakage on developer org. now i am going to install this package on developer sandbox this give me error.

error is below.

 

The package installation failed. Please provide the following information to the publisher:

 

Organization Name: ADT

Organization ID: 00Df0000002Fk5z

Package: Infogroup Match

Version: 1.2

Error Message: The post install script failed.

 

 

when i am going to install this package on other developer org. its install successfully.

i also install this package on other sandbox.

 

but when i going to install this package on client sandbox its give me above error .

 

so please give me solutions.

 

Thanks

bob_buzzardbob_buzzard

Its really difficult to suggest anything here, as you haven't given us any information about what the post install script is doing.  It sounds like it is being affected by the setup of the sandbox - do you try to create any objects that might be affected by validation rules etc?

 

 

prashant1985prashant1985
below is post script code.
in this post script we are inserting my master data into custom tables which i have created.


/*
without sharing global class PostInstallClass implements InstallHandler {
global void onInstall(InstallContext context) {

System.Debug('install....');
if(context.previousVersion() == null) {
Account a = new Account(name='Newco');
insert(a);

System.Debug('install1....' + a);
////


//ContactType

Mapping__c obj_con = new Mapping__c(InfoAttributeName__c='firstname', SFAttributeName__c='firstname',Attribute__c='First Name', Type__c='ContactType',isActive__c='true',SortOrder__c=1);
insert obj_con;

Mapping__c obj_con1 = new Mapping__c(InfoAttributeName__c='LastName', SFAttributeName__c='LastName',Attribute__c='Last Name', Type__c='ContactType',isActive__c='true',SortOrder__c=2);
insert obj_con1;

Mapping__c obj_con2 = new Mapping__c(InfoAttributeName__c='Address', SFAttributeName__c='MailingStreet',Attribute__c='Address', Type__c='ContactType',isActive__c='true',SortOrder__c=3);
insert obj_con2;

Mapping__c obj_con3 = new Mapping__c(InfoAttributeName__c='Title', SFAttributeName__c='Title',Attribute__c='Title', Type__c='ContactType',isActive__c='false',SortOrder__c=4);
insert obj_con3;

Mapping__c obj_con4 = new Mapping__c(InfoAttributeName__c='Email', SFAttributeName__c='Email',Attribute__c='Email Address', Type__c='ContactType',isActive__c='true',SortOrder__c=5);
insert obj_con4;

Mapping__c obj_con5 = new Mapping__c(InfoAttributeName__c='Phone', SFAttributeName__c='Phone',Attribute__c='Phone', Type__c='ContactType',isActive__c='true',SortOrder__c=7);
insert obj_con5;

Mapping__c obj_con6 = new Mapping__c(InfoAttributeName__c='City', SFAttributeName__c='MailingCity',Attribute__c='City', Type__c='ContactType',isActive__c='true',SortOrder__c=10);
insert obj_con6;

Mapping__c obj_con7 = new Mapping__c(InfoAttributeName__c='StateProvince', SFAttributeName__c='MailingState',Attribute__c='State', Type__c='ContactType',isActive__c='true',SortOrder__c=11);
insert obj_con7;

Mapping__c obj_con8 = new Mapping__c(InfoAttributeName__c='PostalCode', SFAttributeName__c='MailingPostalCode',Attribute__c='Zip Code', Type__c='ContactType',isActive__c='true',SortOrder__c=29);
insert obj_con8;

Mapping__c obj_con9 = new Mapping__c(InfoAttributeName__c='Gender', SFAttributeName__c='Gender__c',Attribute__c='Gender', Type__c='ContactType',isActive__c='true',SortOrder__c=42);
insert obj_con9;

//AdditionalC

Mapping__c obj_adcon1 = new Mapping__c(InfoAttributeName__c='IGFirstName', SFAttributeName__c='SFFirstName',Attribute__c='FirstName', Type__c='AdditionalC',isActive__c='true',SortOrder__c=26);
insert obj_adcon1;

Mapping__c obj_adcon2 = new Mapping__c(InfoAttributeName__c='IGLastName', SFAttributeName__c='SFLastName',Attribute__c='LastName', Type__c='AdditionalC',isActive__c='true',SortOrder__c=27);
insert obj_adcon2;

Mapping__c obj_adcon3 = new Mapping__c(InfoAttributeName__c='IGTitle', SFAttributeName__c='SFTitle',Attribute__c='Title', Type__c='AdditionalC',isActive__c='true',SortOrder__c=28);
insert obj_adcon3;

//AccContactType

Mapping__c obj_adAcccon1 = new Mapping__c(InfoAttributeName__c='FirstName', SFAttributeName__c='FirstName',Attribute__c='First Name', Type__c='AccContactType',isActive__c='true',SortOrder__c=33);
insert obj_adAcccon1;

Mapping__c obj_adAcccon2 = new Mapping__c(InfoAttributeName__c='LastName', SFAttributeName__c='LastName',Attribute__c='Last Name', Type__c='AccContactType',isActive__c='true',SortOrder__c=34);
insert obj_adAcccon2;

Mapping__c obj_adAcccon3 = new Mapping__c(InfoAttributeName__c='Title', SFAttributeName__c='Title',Attribute__c='Title', Type__c='AccContactType',isActive__c='true',SortOrder__c=36);
insert obj_adAcccon3;

Mapping__c obj_adAcccon4 = new Mapping__c(InfoAttributeName__c='Email', SFAttributeName__c='Email',Attribute__c='Email Address', Type__c='AccContactType',isActive__c='true',SortOrder__c=37);
insert obj_adAcccon4;

//AccCompType

Mapping__c objAccComp0 = new Mapping__c(InfoAttributeName__c='Address', SFAttributeName__c='BillingStreet',Attribute__c='Address',Type__c='AccCompType',isActive__c='true',SortOrder__c=35);
insert objAccComp0;

Mapping__c objAccComp1 = new Mapping__c(InfoAttributeName__c='Phone', SFAttributeName__c='Phone',Attribute__c='Phone', Type__c='AccCompType',isActive__c='true',SortOrder__c=38);
insert objAccComp1;

Mapping__c objAccComp2 = new Mapping__c(InfoAttributeName__c='City', SFAttributeName__c='BillingCity',Attribute__c='City', Type__c='AccCompType',isActive__c='true',SortOrder__c=39);
insert objAccComp2;

Mapping__c objAccComp3 = new Mapping__c(InfoAttributeName__c='StateProvince', SFAttributeName__c='BillingState',Attribute__c='State', Type__c='AccCompType',isActive__c='true',SortOrder__c=40);
insert objAccComp3;

Mapping__c objAccComp4 = new Mapping__c(InfoAttributeName__c='PostalCode', SFAttributeName__c='BillingPostalCode',Attribute__c='Zip Code', Type__c='AccCompType',isActive__c='true',SortOrder__c=41);
insert objAccComp4;

// leadtype

Mapping__c objL0 = new Mapping__c(InfoAttributeName__c='FirstName', SFAttributeName__c='FirstName',Attribute__c='First Name',Type__c='LeadType',isActive__c='true',SortOrder__c=17);
insert objL0;

Mapping__c objL1 = new Mapping__c(InfoAttributeName__c='LastName', SFAttributeName__c='LastName',Attribute__c='Last Name', Type__c='LeadType',isActive__c='true',SortOrder__c=18);
insert objL1;

Mapping__c objL2 = new Mapping__c(InfoAttributeName__c='Title', SFAttributeName__c='Title',Attribute__c='Title', Type__c='LeadType',isActive__c='false',SortOrder__c=19);
insert objL2;

Mapping__c objL3 = new Mapping__c(InfoAttributeName__c='CompanyName', SFAttributeName__c='Company',Attribute__c='Company', Type__c='LeadType',isActive__c='true',SortOrder__c=20);
insert objL3;

Mapping__c objL4 = new Mapping__c(InfoAttributeName__c='Phone', SFAttributeName__c='Phone',Attribute__c='Phone', Type__c='LeadType',isActive__c='true',SortOrder__c=21);
insert objL4;

Mapping__c objL5 = new Mapping__c(InfoAttributeName__c='City', SFAttributeName__c='City',Attribute__c='City', Type__c='LeadType',isActive__c='true',SortOrder__c=22);
insert objL5;

Mapping__c objL6 = new Mapping__c(InfoAttributeName__c='StateProvince', SFAttributeName__c='State',Attribute__c='State', Type__c='LeadType',isActive__c='true',SortOrder__c=23);
insert objL6;

Mapping__c objL7 = new Mapping__c(InfoAttributeName__c='Address', SFAttributeName__c='Street',Attribute__c='Address', Type__c='LeadType',isActive__c='true',SortOrder__c=24);
insert objL7;

Mapping__c objL8 = new Mapping__c(InfoAttributeName__c='Email', SFAttributeName__c='Email',Attribute__c='Email', Type__c='LeadType',isActive__c='true',SortOrder__c=30);
insert objL8;

Mapping__c objL9 = new Mapping__c(InfoAttributeName__c='PostalCode', SFAttributeName__c='PostalCode',Attribute__c='Zip Code', Type__c='LeadType',isActive__c='false',SortOrder__c=31);
insert objL9;

Mapping__c objL10 = new Mapping__c(InfoAttributeName__c='Uri', SFAttributeName__c='Website',Attribute__c='Website', Type__c='LeadType',isActive__c='true',SortOrder__c=32);
insert objL10;


//company

Mapping__c objC0 = new Mapping__c(InfoAttributeName__c='CompanyName', SFAttributeName__c='Name',Attribute__c='Company Name',Type__c='CompanyType',isActive__c='true',SortOrder__c=6);
insert objC0;

Mapping__c objC1 = new Mapping__c(InfoAttributeName__c='Uri', SFAttributeName__c='Website',Attribute__c='Website', Type__c='CompanyType',isActive__c='true',SortOrder__c=8);
insert objC1;

Mapping__c objC2 = new Mapping__c(InfoAttributeName__c='PostalCode', SFAttributeName__c='BillingPostalCode',Attribute__c='Zip Code', Type__c='CompanyType',isActive__c='false',SortOrder__c=12);
insert objC2;

Mapping__c objC3 = new Mapping__c(InfoAttributeName__c='LocationEmployeesSizeActual', SFAttributeName__c='NumberOfEmployees',Attribute__c='Employee Size', Type__c='CompanyType',isActive__c='true',SortOrder__c=13);
insert objC3;

Mapping__c objC4 = new Mapping__c(InfoAttributeName__c='PrimarySic', SFAttributeName__c='Sic',Attribute__c='SIC Code', Type__c='CompanyType',isActive__c='true',SortOrder__c=14);
insert objC4;

Mapping__c objC5 = new Mapping__c(InfoAttributeName__c='BusinessType', SFAttributeName__c='Industry',Attribute__c='Business Type', Type__c='CompanyType',isActive__c='true',SortOrder__c=15);
insert objC5;

Mapping__c objC6 = new Mapping__c(InfoAttributeName__c='LocationSalesVolumeActual', SFAttributeName__c='AnnualRevenue',Attribute__c='Sales Volume', Type__c='CompanyType',isActive__c='true',SortOrder__c=16);
insert objC6;

Mapping__c objC7 = new Mapping__c(InfoAttributeName__c='PrimarySicDescription', SFAttributeName__c='SicDesc',Attribute__c='SIC Code Description', Type__c='CompanyType',isActive__c='true',SortOrder__c=25);
insert objC7;

Mapping__c objC8 = new Mapping__c(InfoAttributeName__c='CorporateEmployeeSizeRange', SFAttributeName__c='CorporateEmployeeSizeRange',Attribute__c='Corporate Employee Size Range', Type__c='CompanyType',isActive__c='false',SortOrder__c=43);
insert objC8;

Mapping__c objC9 = new Mapping__c(InfoAttributeName__c='CorporateSalesVolumeRange', SFAttributeName__c='CorporateSalesVolumeRange',Attribute__c='Corporate Sales Volume Range', Type__c='CompanyType',isActive__c='false',SortOrder__c=44);
insert objC9;

Mapping__c objC10 = new Mapping__c(InfoAttributeName__c='YearEstablished', SFAttributeName__c='YearInBusiness__c',Attribute__c='Year In Business', Type__c='CompanyType',isActive__c='true',SortOrder__c=45);
insert objC10;




InfogroupSettings__c objinfo = new InfogroupSettings__c(name='Api_Key',IGApiKey__c='c341387ad9f6dc2b81e6c6c3dfef0310', IGCompanyApiUrl__c='https://api.infoconnect.com/v1/companies',IGMatchApiUrl__c='https://api.infoconnect.com/v3/match', IGPeopleApiUrl__c='https://api.infoconnect.com/v1/people');
insert objinfo;






/////


// System.Debug('installobj....' + obj);

User u = [Select Id, Email from User where Id =:context.installerID()];
String toAddress= u.Email;
String[] toAddresses = new String[]{toAddress};
Messaging.SingleEmailMessage mail =
new Messaging.SingleEmailMessage();
mail.setToAddresses(toAddresses);
mail.setReplyTo('support@package.dev');
mail.setSenderDisplayName('My Package Support');
mail.setSubject('Package install successful');
mail.setPlainTextBody('Thanks for installing the package.');
Messaging.sendEmail(new Messaging.Email[] { mail });
}
else
if(context.previousVersion().compareTo(new Version(1,0)) == 0) {
///





///

}
if(context.isUpgrade()) {
///////////////





//////////////
}
if(context.isPush()) {

/////////////////////






/////////////////


}
System.Debug('install2....');
}

@isTest
static void testInstallScript()
{
PostInstallClass postinstall = new PostInstallClass();
Test.testInstall(postinstall, null);
Test.testInstall(postinstall, new Version(1,0), true);
List<Account> a = [Select id, name from Account where name ='Newco'];
System.assertEquals(a.size(), 1, 'Account not found');
}
}
bob_buzzardbob_buzzard

The first thing you are doing is inserting a new account - does the sandbox have any validation rules or required fields that mean you would need more than just the account name to insert a record?

prashant1985prashant1985
actually we are installing this package on client sandbox so currently i don't know which fields are required on their environment.

But i already install this package on my sandbox. but its give me error on client sandbox.
bob_buzzardbob_buzzard

That's the problem though - just because it installs into one org, doesn't mean it will install into another, as the second org may have different required fields and validation rules etc. There's not a lot you can do about this, as every org could be different so predicting which fields you need to supply is likely to be an exercise in futility.