Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8337505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:19:27+00:00 2026-06-09T04:19:27+00:00

On our managed package, we have a PostInstallClass that implements the InstallHandler interface. We

  • 0

On our managed package, we have a PostInstallClass that implements the InstallHandler interface. We use it to populate new fields when they are added in later versions, or fix data when the model changes.

However, we have trouble finding a way to test this migrations. For instance: we added a new field that is used in a trigger. We want to insert some records with that field emtpy (as it will be when creating the field), but without firing the trigger, which would fail.

Is there any way that we can do something like this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:19:29+00:00Added an answer on June 9, 2026 at 4:19 am

    I would suggest implementing a protected custom setting object (Protected, because your don’t want your subscribers to be able to modify it). This was you can disable your trigger e.g

    trigger <name> on Account (<events>) {
        Configuration_Options__c options = Configuration_Options__c.getOrgDefaults();
        if(options.Trigger_Enabled__c) {
            //perform all the actions in the trigger
        }
    }
    

    Then in the unit test you can control whether the trigger performs it’s actions

    private static testMethod void testPostInstallClass() {
        PostInstallClass postinstall = new PostInstallClass();
        Configuration_Options__c options = Configuration_Options__c.getOrgDefaults();
    
        //disable the trigger
        options.Trigger_Enabled__c = false;
        update options;
    
        //insert your legacy records here
    
        //re-enable the trigger
        options.Trigger_Enabled__c = true;
        update options;
    
        //run the install script
        Test.testInstall(postinstall, null);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our git-svn managed project, we have 3 upstream projects that are all kept
We've got a set of forms in our web application that is managed by
For our CMS we have a site manager that defines the site's tree structure
We have several software packages (SolidWorks, Pro/ENGINEER, OrCAD, Minitab... ) that use FlexLM to
We are trying to use Nuget for our internally generated packages. We have setup
I've had a couple of complaints that one of our managed apps is using
Currently, I found that it's very inefficient use of Maven in our team. So
We have been trying to use virtual machines for build servers. Our build servers
We have a problem that we're sure that it's already solved. Our research team
We created some libraries that all our projects will use, this libraries will provide

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.