function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
arun thakurarun thakur 

InstallHandler-specified apex code not running during package instillation

We are trying to insert some records in lead object but APEX code that implement  this interface not executing during manage package installation ,Please review my code and advise us

   

 

global class InstallClass implements InstallHandler 
{
global void onInstall(InstallContext context) 
{
if(context.previousVersion() == null) {
lead ObjLead=new Lead();
ObjLead.LastName='InstallClass';
ObjLead.Company='InstallClass';
insert ObjLead;



}
public static testMethod void testRunAs() 
{
Test.testInstall(new InstallClass(),null);}

}

 

BritishBoyinDCBritishBoyinDC

Is the PostInstall script on the Package Detail screen?

arun thakurarun thakur

Yes we have this script in our "Package Detail screen"

BritishBoyinDCBritishBoyinDC

Do you know if the script is running at all, or is that the lead creation is failing? Have you tried something else aside from the lead creation - e..g sending an email?