---
schema_version: "1"
id: e2081a2c9c756c0291eb38d44d53b1014dd74f6219eb2070c654c59ea3aca22d
title: Enable a Package Subscriber to Restrict Push Upgrades
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform-pkg-exchange/managed_packaging/guides/first-generation/push-upgrade-customized.md
canonical_url: https://developer.salesforce.com/docs/platform/pkg1-dev/guide/push-upgrade-customized.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c79dada109246508ab8ffe484d3b27e5b79940950ba2672676513743df877010
products:
  - First-Generation Managed Packaging Developer Guide
  - merged-docs
---

# Enable a Package Subscriber to Restrict Push Upgrades

In certain scenarios, a Salesforce customer may require the ability to block push upgrades of managed packages that they have installed in their org. Customized push upgrades let Salesforce Partners give customers the ability to restrict push upgrades to a specific customer org for a specific package.

Setting up customized push upgrades requires both the Salesforce Partner and Salesforce Customer to complete specific enablement steps.

1.  The Salesforce Partner enables customized push upgrades for a package installed in the customer org.


    1.  As the Salesforce Partner, log in to either your 1GP packaging org, or your Dev Hub org (for managed 2GP packages) using the system administrator account.

    2.  Click the gear icon and select **Developer Console**.

    3.  In the Developer Console, select **Debug**, and then select **Open Execute Anonymous Window**.

    4.  Enter the following code, but remember to replace the packageID (starts with `033`) and subscriberOrgID (starts with `00D`) text for the package ID and customer org you’re enabling.

        ```nolang
        String pucId1 = PushUpgradeCustomizationRepository.create('packageID', 'subscriberOrgID', true);
        System.debug('pucId1 =' + pucId1);
        ```

        Optionally, you can set the ability to block push upgrades to expire after a certain number of days. This example sets customized push upgrades to expire after 90 days.

        ```nolang
        String pucId1 = PushUpgradeCustomizationRepository.create('packageID', 'subscriberOrgID', true, 90);
        System.debug('pucId1 =' + pucId1);
        ```

        If the customer wants to block push upgrades to multiple production orgs, you must specify each org ID. Here’s an example of how to enable customized push upgrades for more than one org.

        ```nolang
        String pucId1 = PushUpgradeCustomizationRepository.create('packageID', 'subscriberOrgID', true);
        System.debug('pucId1 =' + pucId1);

        String pucId2 = PushUpgradeCustomizationRepository.create('packageID', 'subscriberOrgID', true);
        System.debug('pucId2 =' + pucId2);
        ```

    5.  Click **Open Log** and then click **Execute**.

    6.  Click the **Debug Only** checkbox and verify that the push upgrade customization record was created.

        The record looks something like: `11:09:15:814 USER_DEBUG [2]|DEBUG|pucId1 =12COK000000000B`

    7.  Contact the Salesforce Customer and let them know that customized push upgrades is enabled on your end.

    **note:** Sandbox orgs automatically get the ability to block push upgrades if the parent production org has been granted the ability to block push upgrades by the Salesforce Partner.

2.  After the Salesforce Partner enables customized push upgrades, the Salesforce Customer blocks push upgrades from Setup in the customer org.


    1.  As the Salesforce Customer, log in to your org.

    2.  From Setup, enter `Installed Packages` in the Quick Find box, and then select **Installed Packages**.

    3.  Select the package that you’ve requested to block push upgrades, and then select **Block Push Upgrades**.

    4.  Verify that the **Push upgrades are now blocked** checkbox is selected.

## Next Steps

**note:** It’s not possible to block push upgrades on a patch version of a package. If the customer has a patch version installed, they must upgrade to a non-patch version of the package before they can block push upgrades.

Salesforce Customers can resume push upgrades at any time by selecting the **Allow Push Upgrades** button. While the block is enabled, package upgrades can only be installed manually.

Salesforce Partners can view and manage existing customized push upgrades by using the PushUpgradeCustomizationRepository Apex Class. If you enabled customized push upgrades for a subscriber with an expiration, you can update the expiration days by following Step 1. For Step 1d, use either the setExpirationDaysForId or setExpirationDaysForIndex method to update the expiration days. This example updates the expiration days to 100 days.

```nolang
PushUpgradeCustomizationRepository.setExpirationDaysForIndex('packageID', 'subscriberOrgID', 100);
System.debug('Expiration days updated successfully');
```

This example updates the expiration days for the PushUpgradeCustomization record ID 12Cxx000000ABCDEF1 to 120 days.

```nolang
PushUpgradeCustomizationRepository.setExpirationDaysForId('12Cxx000000ABCDEF1', 120);
System.debug('Expiration days updated successfully');
```

**note:** If the customer has blocked push upgrades from the subscriber org, it’s not possible to decrease the number of expiration days.
