Happy Business Starts Here

How do I skip Guided Product Selector steps & directly jump to the add product page?

Highlighted
Zuora Staff

How do I skip Guided Product Selector steps & directly jump to the add product page?

Problem:  Some users don't want to use Guided Product Selector as they have only one Guided Product Selector for each New and Amendment Quote.  In this case, the user wants to directly jump to Add Product Page. But the Zuora -> newly designed add product page will not allow the user to disable the guided product selector option in Zuora Config, if you disable then it will throw an error while creating the quote record. 

Annotation 2020-05-01 1746151215.png

 

Solution:  In order to achieve this, we have to follow the below steps so you can skip the guided product selector page. 

Step 1:  Guided Product Selector is mandatory for newly created Add Product Page so you have to create at least one guided product selector for New and Amend Quote.Annotation 2020-05-01 172629.png

Step 2: Create below apex class in your org.  

global class QuoteUpdatePlugin extends zqu.CreateQuoteController.UpdateRecordPlugin  
{  global override PageReference doUpdate (SObject record, zqu.PropertyComponentController.ParentController parentController)
    {
        zqu__Quote__c quote = (zqu__Quote__c) record;
        insert quote;

        PageReference redirectPage = new PageReference('https://zqu.ap4.visual.force.com/apex/EditQuoteProducts');
    
        redirectPage.getParameters().put('crmAccountId', ApexPages.currentPage().getParameters().get('crmAccountId'));
        redirectPage.getParameters().put('id', quote.Id);
        redirectPage.getParameters().put('oppId', ApexPages.currentPage().getParameters().get('oppId'));
        redirectPage.getParameters().put('quoteType', ApexPages.currentPage().getParameters().get('quoteType'));
        redirectPage.getParameters().put('stepNumber', '3');
        
        if(ApexPages.currentPage().getParameters().get('quoteType') == 'Subscription')
        {
            redirectPage.getParameters().put('editQuoteProductsMode', 'GuidedSelling');
            redirectPage.getParameters().put('flowId', [Select Id from zqu__GuidedSellingFlow__c].Id);
            redirectPage.getParameters().put('stepId', [Select Id from zqu__GuidedSellingStep__c].Id);
            
            if(ApexPages.currentPage().getParameters().containsKey('billingAccountId'))
                redirectPage.getParameters().put('billingAccountId', ApexPages.currentPage().getParameters().get('billingAccountId'));
        }
        else
        {
            redirectPage.getParameters().put('editQuoteProductsMode', 'GuidedSelling');
            redirectPage.getParameters().put('flowId', [Select Id from zqu__GuidedSellingFlow__c].Id);
            redirectPage.getParameters().put('stepId', [Select Id from zqu__GuidedSellingStep__c].Id);
            if(ApexPages.currentPage().getParameters().containsKey('billingAccountId'))
                   redirectPage.getParameters().put('billingAccountId', ApexPages.currentPage().getParameters().get('billingAccountId'));
        }

        redirectPage.setRedirect(true);
        
       return redirectPage;
    }    
}

Step 3: Register your class in Zuora Config -> Component Registration -> CreateQuote

Annotation 2020-05-01 1726291.png

 

Step 4:  Try to create a new/Amend Quote, it will skip your Guided Product Selector page automatically. 

Annotation 2020-05-01 17461512.png

 

 

Thanks and Regards,
Prem Anandh