• Jonathan Yern 4
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
I was able to successfully deploy a change via FORCE.COM + Eclipse. I wanted to delete an APEX class by updating the Status from "Active" to "Deleted". Force.com IDE told me the deployment was successful in production. However when i check Salesforce the Apex class is still there and active.Any help would be greatly appreciated.
Hi I am trying to delete the an APEX class in production. 

Steps/Results taken:
1. loaded apex class
2. updated status of Meta data xml file from "Active" to "Deleted"
3. Deployed to Salesforce
4. Eclipse showed Deployment was a Success
 - NOTE: I was able to delete another Apex Class without issue just before trying to delete this one

Results from Log
# Deploy Results:
   File Name:    classes/ExportPartnerPriceListsController.cls
   Full Name:  ExportPartnerPriceListsController
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a
 
   File Name:    package.xml
   Full Name:  package.xml
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a
 
# Test Results:
   n/a



ISSUE: The Apex Class in Production was still Active

Possible Issue/Resolution? This Apex Class' Code Coverage =  81% (88/108)



APEX CLASS

public with sharing class ExportPartnerPriceListsController {
    public Id pricebookId {get; set;}
    public SelectOption[] pricebookOptions {get; private set;}
    
    private transient Folder targetFolder;
    private transient PricebookEntry[] entries;
    private transient Product2[] hwMaintenance;
    private transient Product2[] swMaintenance;
    private transient Map<Id, Discount_Category__c> categoriesById;
    private transient Map<Id,Product2> bundles;
    
    public ExportPartnerPriceListsController(ApexPages.StandardSetController stdController) {
        pricebookOptions = new SelectOption[0];
        for (Pricebook2 pb : [SELECT Id, Name FROM Pricebook2 WHERE IsActive = true]) {
            pricebookOptions.add(new SelectOption(pb.Id, pb.Name));
        }
    }
    
    public PageReference onGenerate() {
        targetFolder = [SELECT Id FROM Folder WHERE DeveloperName = 'PartnerPriceLists'];
        generateDeferred(targetFolder.Id, pricebookId);
        
        PageReference pref = new PageReference('/015');
        pref.getParameters().put('fcf', String.valueOf(targetFolder.Id).substring(0,15));
        return pref;
    }
    
    @future
    public static void generateDeferred(Id targetFolderId, Id pricebookId) {
        ExportPartnerPriceListsController target = new ExportPartnerPriceListsController(null);
        target.generate(targetFolderId, pricebookId);
    }
    
    public void generate(Id targetFolderId, Id pricebookId) {
        targetFolder = [SELECT Id FROM Folder WHERE Id = :targetFolderId];
        this.pricebookId = pricebookId;
        
        categoriesById = 
            new Map<Id,Discount_Category__c>([SELECT Distributor_Discount__c, Distributor_Disc_45_45__c, OEM_Discount__c, Premier_CSP_Discount__c, Premier_Plus_Reseller_Disc__c, Premier_Plus_Reseller_Disc_40__c, Premier_Plus_Reseller_Disc_45__c, Premier_Reseller_Discount__c, Registered_Deal_Uplift__c, System_Builder_Discount__c FROM Discount_Category__c]);
        hwMaintenance = loadMaintenanceProducts('Hardware');
        swMaintenance = loadMaintenanceProducts('Software');
        Partner_Level_Mapping__c[] levels = Test.isRunningTest() ? new Partner_Level_Mapping__c[]{new Partner_Level_Mapping__c(Name='Distributor 35/40',Discount_Field_Name__c='Distributor_Discount__c')} : Partner_Level_Mapping__c.getAll().values();
        entries = [SELECT UnitPrice, Product2.Discount_Category__c, Product2.SBQQ__SubscriptionCategory__c, Product2.SBQQ__ExcludeFromMaintenance__c, Product2.ProductCode, Product2.Name, Product2.Description, Product2.Product_Type__c, product2.family, product2.product_category__c FROM PricebookEntry WHERE Pricebook2Id = :pricebookId AND IsActive = true AND Product2.SBQQ__SubscriptionPricing__c = null];
        bundles = new Map<Id,Product2>([SELECT Name, ProductCode, Description, (SELECT SBQQ__UnitPrice__c, SBQQ__OptionalSKU__r.SBQQ__SubscriptionCategory__c FROM SBQQ__Options__r) FROM Product2 WHERE SBQQ__ConfigurationType__c != null AND SBQQ__ExcludeFromMaintenance__c = true]);
        for (Partner_Level_Mapping__c level : levels) {
            generateInternal(level);
        }
    }
    
    private void generateInternal(Partner_Level_Mapping__c level) {
        String csv = generateHeader();
        system.debug('JBJB At start csv:' + csv); 
        for (PricebookEntry entry : entries) {
            Discount_Category__c cat = categoriesById.get(entry.Product2.Discount_Category__c);
            Decimal discount = 0;
            if (cat != null) {
                discount = (Decimal)cat.get(level.Discount_Field_Name__c);
                if (discount == null) {
                    discount = 0;
                }
            }
            
            csv += generateProductLine(entry, discount);
            if ((entry.Product2.SBQQ__ExcludeFromMaintenance__c == false) && (entry.Product2.SBQQ__SubscriptionCategory__c != null)) {
                if (entry.Product2.SBQQ__SubscriptionCategory__c.equalsIgnoreCase('hardware')) {
                    csv += generateServiceLines(entry, discount, hwMaintenance);
                } else if (entry.Product2.SBQQ__SubscriptionCategory__c.equalsIgnoreCase('software')) {
                    csv += generateServiceLines(entry, discount, swMaintenance);
                }
            } else if (bundles.containsKey(entry.Product2.Id)) {
                csv += generateBundleServiceLines(bundles.get(entry.Product2.Id), discount, hwMaintenance, swMaintenance);
            }
        }
        
        
        
        Document doc = new Document(Name=level.Name + ' ' + System.today() + ' Price List.csv',Body=Blob.valueOf(csv),FolderId=targetFolder.Id);
        system.debug('JBJB At write csv:' + csv); 

        insert doc;
        system.debug('JBJB At start end' + doc); 

    }
    
    private Product2[] loadMaintenanceProducts(String category) {
        Set<Id> productIds = new Set<Id>();
        for (PricebookEntry entry : [SELECT Product2Id FROM PricebookEntry WHERE Product2.SBQQ__SubscriptionCategory__c = :category AND Product2.SBQQ__SubscriptionPricing__c != null AND Pricebook2Id = :pricebookId AND IsActive = true]) {
            productIds.add(entry.Product2Id);
        }
        return [SELECT ProductCode, Name, Description, Product_Type__c, SBQQ__SubscriptionPercent__c, Discount_Category__c, Family, Product_Category__c FROM Product2 WHERE Id = :productIds];
    }
    
    
    private String generateHeader() {
        return '"Manufacturer", "Part Number", "Unique Part Number", "Product Name", "Product Type", "Description", "Unit List Price", "Partner Discount", "Partner Price", "Product Family", "Product Category"';
    }
    
    private String generateProductLine(PricebookEntry entry, Decimal discount) {
        String line = '\n';
        line += 'Vidyo,';
        line += '"' + escapeValue(entry.Product2.ProductCode) + '",';
        line += '"' + escapeValue(entry.Product2.ProductCode) + '",';
        line += '"' + escapeValue(entry.Product2.Name) + '",';
        line += '"' + entry.Product2.Product_Type__c + '",';
        line += '"' + escapeValue(entry.Product2.Description) + '",';
        line += '"' + entry.UnitPrice + '",';
        line += '"' + discount + '",';
        line += '"' + (entry.UnitPrice * (100 - discount) / 100) + '",';
        line += '"' + entry.Product2.family + '",';
        line += '"' + entry.Product2.Product_category__c + '",';
             
        return line;
    }
    
    private String generateServiceLines(PricebookEntry entry, Decimal discount, Product2[] services) {
        System.assert(entry.UnitPrice != null);
        String lines = '';
        for (Product2 service : services) {
            String serviceCode = (service.ProductCode != null) ? service.ProductCode : '';
            String productCode = (entry.Product2.ProductCode != null) ? entry.Product2.ProductCode : '';
            if (service.SBQQ__SubscriptionPercent__c != null) {
                lines += '\n';
                lines += 'Vidyo,';
                lines += '"' + escapeValue(serviceCode) + '",';
                lines += '"' + escapeValue(serviceCode.replace('SVC-','SVC-' + productCode.replace('DEV-','') + '-')) + '",';
                lines += '"' + escapeValue(service.Name) + '",';
                lines += '"' + escapeValue(service.Product_Type__c) + '",';
                lines += '"' + escapeValue(service.Description) + '",';
                lines += '"' + entry.UnitPrice * service.SBQQ__SubscriptionPercent__c / 100 + '",';
                lines += '"' + discount + '",';
                lines += '"' + ((entry.UnitPrice * service.SBQQ__SubscriptionPercent__c / 100)  * (100 - discount) / 100) + '",';
                lines += '"' + service.family + '",';
                lines += '"' + service.Product_category__c + '",';

            }
        }
        return lines;
    }
    
    private String generateBundleServiceLines(Product2 product, Decimal discount, Product2[] hwServices, Product2[] swServices) {
        Map<Id,Decimal> servicePrices = new Map<Id,Decimal>();
        SBQQ__ProductOption__c hwOption;
        SBQQ__ProductOption__c swOption;
        for (SBQQ__ProductOption__c opt : product.SBQQ__Options__r) {
            if (opt.SBQQ__OptionalSKU__r.SBQQ__SubscriptionCategory__c == 'Hardware') {
                hwOption = opt;
            } else if (opt.SBQQ__OptionalSKU__r.SBQQ__SubscriptionCategory__c == 'Software') {
                swOption = opt;
            }
        }
        
        String lines = '';
        if (hwOption != null) {
            lines += generateServiceLines(new PricebookEntry(Product2=product,UnitPrice=hwOption.SBQQ__UnitPrice__c), discount, hwServices);
        }
        if (swOption != null) {
            lines += generateServiceLines(new PricebookEntry(Product2=product,UnitPrice=swOption.SBQQ__UnitPrice__c), discount, swServices);
        }
        
        return lines;
    }
    
    private String escapeValue(String value) {
        if (value != null) {
            value = value.replace('"', '""');
        }
        return value;
    }
    
    testMethod static void test() {
        Partner_Level_Mapping__c mapping = new Partner_Level_Mapping__c(Name='Distributor 35/40',Discount_Field_Name__c='Distributor_Discount__c');
        insert mapping;
        
        Pricebook2 spb = new Pricebook2(Id='01s70000000EYoq');
        Pricebook2 pb = new Pricebook2(Name='Test',IsActive=true);
        insert pb;
        
        Discount_Category__c dc = new Discount_Category__c(Name='Test',Distributor_Discount__c=30);
        insert dc;
        
        Product2[] products = new Product2[0];
        products.add(new Product2(Name='HW', ProductCode='VDYO-HW',SBQQ__SubscriptionCategory__c='Hardware',Description='HW 9" DESC', Product_Type__c='HARDWARE',Discount_Category__c=dc.Id,IsActive=true));
        products.add(new Product2(Name='Gold', ProductCode='SVC-GLD-1YR',SBQQ__SubscriptionCategory__c='Hardware',SBQQ__SubscriptionPercent__c=25,SBQQ__SubscriptionPricing__c='Percent of Total',Description='Gold Service', Product_Type__c='SERVICE',Discount_Category__c=dc.Id,IsActive=true));
        insert products;
        
        PricebookEntry[] spbe = new PricebookEntry[0];
        spbe.add(new PricebookEntry(Pricebook2Id=spb.Id,UnitPrice=1000,IsActive=true,Product2Id=products[0].Id));
        spbe.add(new PricebookEntry(Pricebook2Id=spb.Id,UnitPrice=0,IsActive=true,Product2Id=products[1].Id));
        insert spbe;
        
        PricebookEntry[] pbe = new PricebookEntry[0];
        pbe.add(new PricebookEntry(Pricebook2Id=pb.Id,UnitPrice=1000,IsActive=true,Product2Id=products[0].Id));
        pbe.add(new PricebookEntry(Pricebook2Id=pb.Id,UnitPrice=0,IsActive=true,Product2Id=products[1].Id));
        insert pbe;
        
        ExportPartnerPriceListsController target = new ExportPartnerPriceListsController(new ApexPages.StandardSetController(new Product2[0]));
        target.pricebookId = pb.Id;
        Test.startTest();
        PageReference pref = target.onGenerate();
        Test.stopTest();
        System.assert(pref != null);
    }
}
 
Hi,

Is there a way I can auto populate the Contact roles on an opportuntity with a custom button based on the account name that is on the opportunity? Can I use Flows and Process builder? If so, how.

Note: Contact is not on the opportunity.







 
Hi I am trying to delete the an APEX class in production. 

Steps/Results taken:
1. loaded apex class
2. updated status of Meta data xml file from "Active" to "Deleted"
3. Deployed to Salesforce
4. Eclipse showed Deployment was a Success
 - NOTE: I was able to delete another Apex Class without issue just before trying to delete this one

Results from Log
# Deploy Results:
   File Name:    classes/ExportPartnerPriceListsController.cls
   Full Name:  ExportPartnerPriceListsController
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a
 
   File Name:    package.xml
   Full Name:  package.xml
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a
 
# Test Results:
   n/a



ISSUE: The Apex Class in Production was still Active

Possible Issue/Resolution? This Apex Class' Code Coverage =  81% (88/108)



APEX CLASS

public with sharing class ExportPartnerPriceListsController {
    public Id pricebookId {get; set;}
    public SelectOption[] pricebookOptions {get; private set;}
    
    private transient Folder targetFolder;
    private transient PricebookEntry[] entries;
    private transient Product2[] hwMaintenance;
    private transient Product2[] swMaintenance;
    private transient Map<Id, Discount_Category__c> categoriesById;
    private transient Map<Id,Product2> bundles;
    
    public ExportPartnerPriceListsController(ApexPages.StandardSetController stdController) {
        pricebookOptions = new SelectOption[0];
        for (Pricebook2 pb : [SELECT Id, Name FROM Pricebook2 WHERE IsActive = true]) {
            pricebookOptions.add(new SelectOption(pb.Id, pb.Name));
        }
    }
    
    public PageReference onGenerate() {
        targetFolder = [SELECT Id FROM Folder WHERE DeveloperName = 'PartnerPriceLists'];
        generateDeferred(targetFolder.Id, pricebookId);
        
        PageReference pref = new PageReference('/015');
        pref.getParameters().put('fcf', String.valueOf(targetFolder.Id).substring(0,15));
        return pref;
    }
    
    @future
    public static void generateDeferred(Id targetFolderId, Id pricebookId) {
        ExportPartnerPriceListsController target = new ExportPartnerPriceListsController(null);
        target.generate(targetFolderId, pricebookId);
    }
    
    public void generate(Id targetFolderId, Id pricebookId) {
        targetFolder = [SELECT Id FROM Folder WHERE Id = :targetFolderId];
        this.pricebookId = pricebookId;
        
        categoriesById = 
            new Map<Id,Discount_Category__c>([SELECT Distributor_Discount__c, Distributor_Disc_45_45__c, OEM_Discount__c, Premier_CSP_Discount__c, Premier_Plus_Reseller_Disc__c, Premier_Plus_Reseller_Disc_40__c, Premier_Plus_Reseller_Disc_45__c, Premier_Reseller_Discount__c, Registered_Deal_Uplift__c, System_Builder_Discount__c FROM Discount_Category__c]);
        hwMaintenance = loadMaintenanceProducts('Hardware');
        swMaintenance = loadMaintenanceProducts('Software');
        Partner_Level_Mapping__c[] levels = Test.isRunningTest() ? new Partner_Level_Mapping__c[]{new Partner_Level_Mapping__c(Name='Distributor 35/40',Discount_Field_Name__c='Distributor_Discount__c')} : Partner_Level_Mapping__c.getAll().values();
        entries = [SELECT UnitPrice, Product2.Discount_Category__c, Product2.SBQQ__SubscriptionCategory__c, Product2.SBQQ__ExcludeFromMaintenance__c, Product2.ProductCode, Product2.Name, Product2.Description, Product2.Product_Type__c, product2.family, product2.product_category__c FROM PricebookEntry WHERE Pricebook2Id = :pricebookId AND IsActive = true AND Product2.SBQQ__SubscriptionPricing__c = null];
        bundles = new Map<Id,Product2>([SELECT Name, ProductCode, Description, (SELECT SBQQ__UnitPrice__c, SBQQ__OptionalSKU__r.SBQQ__SubscriptionCategory__c FROM SBQQ__Options__r) FROM Product2 WHERE SBQQ__ConfigurationType__c != null AND SBQQ__ExcludeFromMaintenance__c = true]);
        for (Partner_Level_Mapping__c level : levels) {
            generateInternal(level);
        }
    }
    
    private void generateInternal(Partner_Level_Mapping__c level) {
        String csv = generateHeader();
        system.debug('JBJB At start csv:' + csv); 
        for (PricebookEntry entry : entries) {
            Discount_Category__c cat = categoriesById.get(entry.Product2.Discount_Category__c);
            Decimal discount = 0;
            if (cat != null) {
                discount = (Decimal)cat.get(level.Discount_Field_Name__c);
                if (discount == null) {
                    discount = 0;
                }
            }
            
            csv += generateProductLine(entry, discount);
            if ((entry.Product2.SBQQ__ExcludeFromMaintenance__c == false) && (entry.Product2.SBQQ__SubscriptionCategory__c != null)) {
                if (entry.Product2.SBQQ__SubscriptionCategory__c.equalsIgnoreCase('hardware')) {
                    csv += generateServiceLines(entry, discount, hwMaintenance);
                } else if (entry.Product2.SBQQ__SubscriptionCategory__c.equalsIgnoreCase('software')) {
                    csv += generateServiceLines(entry, discount, swMaintenance);
                }
            } else if (bundles.containsKey(entry.Product2.Id)) {
                csv += generateBundleServiceLines(bundles.get(entry.Product2.Id), discount, hwMaintenance, swMaintenance);
            }
        }
        
        
        
        Document doc = new Document(Name=level.Name + ' ' + System.today() + ' Price List.csv',Body=Blob.valueOf(csv),FolderId=targetFolder.Id);
        system.debug('JBJB At write csv:' + csv); 

        insert doc;
        system.debug('JBJB At start end' + doc); 

    }
    
    private Product2[] loadMaintenanceProducts(String category) {
        Set<Id> productIds = new Set<Id>();
        for (PricebookEntry entry : [SELECT Product2Id FROM PricebookEntry WHERE Product2.SBQQ__SubscriptionCategory__c = :category AND Product2.SBQQ__SubscriptionPricing__c != null AND Pricebook2Id = :pricebookId AND IsActive = true]) {
            productIds.add(entry.Product2Id);
        }
        return [SELECT ProductCode, Name, Description, Product_Type__c, SBQQ__SubscriptionPercent__c, Discount_Category__c, Family, Product_Category__c FROM Product2 WHERE Id = :productIds];
    }
    
    
    private String generateHeader() {
        return '"Manufacturer", "Part Number", "Unique Part Number", "Product Name", "Product Type", "Description", "Unit List Price", "Partner Discount", "Partner Price", "Product Family", "Product Category"';
    }
    
    private String generateProductLine(PricebookEntry entry, Decimal discount) {
        String line = '\n';
        line += 'Vidyo,';
        line += '"' + escapeValue(entry.Product2.ProductCode) + '",';
        line += '"' + escapeValue(entry.Product2.ProductCode) + '",';
        line += '"' + escapeValue(entry.Product2.Name) + '",';
        line += '"' + entry.Product2.Product_Type__c + '",';
        line += '"' + escapeValue(entry.Product2.Description) + '",';
        line += '"' + entry.UnitPrice + '",';
        line += '"' + discount + '",';
        line += '"' + (entry.UnitPrice * (100 - discount) / 100) + '",';
        line += '"' + entry.Product2.family + '",';
        line += '"' + entry.Product2.Product_category__c + '",';
             
        return line;
    }
    
    private String generateServiceLines(PricebookEntry entry, Decimal discount, Product2[] services) {
        System.assert(entry.UnitPrice != null);
        String lines = '';
        for (Product2 service : services) {
            String serviceCode = (service.ProductCode != null) ? service.ProductCode : '';
            String productCode = (entry.Product2.ProductCode != null) ? entry.Product2.ProductCode : '';
            if (service.SBQQ__SubscriptionPercent__c != null) {
                lines += '\n';
                lines += 'Vidyo,';
                lines += '"' + escapeValue(serviceCode) + '",';
                lines += '"' + escapeValue(serviceCode.replace('SVC-','SVC-' + productCode.replace('DEV-','') + '-')) + '",';
                lines += '"' + escapeValue(service.Name) + '",';
                lines += '"' + escapeValue(service.Product_Type__c) + '",';
                lines += '"' + escapeValue(service.Description) + '",';
                lines += '"' + entry.UnitPrice * service.SBQQ__SubscriptionPercent__c / 100 + '",';
                lines += '"' + discount + '",';
                lines += '"' + ((entry.UnitPrice * service.SBQQ__SubscriptionPercent__c / 100)  * (100 - discount) / 100) + '",';
                lines += '"' + service.family + '",';
                lines += '"' + service.Product_category__c + '",';

            }
        }
        return lines;
    }
    
    private String generateBundleServiceLines(Product2 product, Decimal discount, Product2[] hwServices, Product2[] swServices) {
        Map<Id,Decimal> servicePrices = new Map<Id,Decimal>();
        SBQQ__ProductOption__c hwOption;
        SBQQ__ProductOption__c swOption;
        for (SBQQ__ProductOption__c opt : product.SBQQ__Options__r) {
            if (opt.SBQQ__OptionalSKU__r.SBQQ__SubscriptionCategory__c == 'Hardware') {
                hwOption = opt;
            } else if (opt.SBQQ__OptionalSKU__r.SBQQ__SubscriptionCategory__c == 'Software') {
                swOption = opt;
            }
        }
        
        String lines = '';
        if (hwOption != null) {
            lines += generateServiceLines(new PricebookEntry(Product2=product,UnitPrice=hwOption.SBQQ__UnitPrice__c), discount, hwServices);
        }
        if (swOption != null) {
            lines += generateServiceLines(new PricebookEntry(Product2=product,UnitPrice=swOption.SBQQ__UnitPrice__c), discount, swServices);
        }
        
        return lines;
    }
    
    private String escapeValue(String value) {
        if (value != null) {
            value = value.replace('"', '""');
        }
        return value;
    }
    
    testMethod static void test() {
        Partner_Level_Mapping__c mapping = new Partner_Level_Mapping__c(Name='Distributor 35/40',Discount_Field_Name__c='Distributor_Discount__c');
        insert mapping;
        
        Pricebook2 spb = new Pricebook2(Id='01s70000000EYoq');
        Pricebook2 pb = new Pricebook2(Name='Test',IsActive=true);
        insert pb;
        
        Discount_Category__c dc = new Discount_Category__c(Name='Test',Distributor_Discount__c=30);
        insert dc;
        
        Product2[] products = new Product2[0];
        products.add(new Product2(Name='HW', ProductCode='VDYO-HW',SBQQ__SubscriptionCategory__c='Hardware',Description='HW 9" DESC', Product_Type__c='HARDWARE',Discount_Category__c=dc.Id,IsActive=true));
        products.add(new Product2(Name='Gold', ProductCode='SVC-GLD-1YR',SBQQ__SubscriptionCategory__c='Hardware',SBQQ__SubscriptionPercent__c=25,SBQQ__SubscriptionPricing__c='Percent of Total',Description='Gold Service', Product_Type__c='SERVICE',Discount_Category__c=dc.Id,IsActive=true));
        insert products;
        
        PricebookEntry[] spbe = new PricebookEntry[0];
        spbe.add(new PricebookEntry(Pricebook2Id=spb.Id,UnitPrice=1000,IsActive=true,Product2Id=products[0].Id));
        spbe.add(new PricebookEntry(Pricebook2Id=spb.Id,UnitPrice=0,IsActive=true,Product2Id=products[1].Id));
        insert spbe;
        
        PricebookEntry[] pbe = new PricebookEntry[0];
        pbe.add(new PricebookEntry(Pricebook2Id=pb.Id,UnitPrice=1000,IsActive=true,Product2Id=products[0].Id));
        pbe.add(new PricebookEntry(Pricebook2Id=pb.Id,UnitPrice=0,IsActive=true,Product2Id=products[1].Id));
        insert pbe;
        
        ExportPartnerPriceListsController target = new ExportPartnerPriceListsController(new ApexPages.StandardSetController(new Product2[0]));
        target.pricebookId = pb.Id;
        Test.startTest();
        PageReference pref = target.onGenerate();
        Test.stopTest();
        System.assert(pref != null);
    }
}