Happy Business Starts Here

Re: Using Filter Plugin to filter out products and Rate Plan

Z-Support SME

Using Filter Plugin to filter out products and Rate Plan

Problem:

 

Customer needed help in using Filter Plugin code to display Products and Rate Plan based on a custom field value.

Customer had a custom field 'Retired__c' both on Product and Product rate Plan object , based on what they would like to filter out displaying products and Rate Plans. 



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

2 REPLIES
Z-Support SME

Re: Using Filter Plugin to filter out products and Rate Plan

Solution:

 

1) First, create a custom Apex class by overriding the IFilterPlugin used in the SelectProduct component.

Following is the Filter Plugin code that they needed to implement

 

 

global class zCustomProductFilterPlugin implements zqu.SelectProductComponentOptions.IFilterPlugin
{    
  String quoteId;
  public zCustomProductFilterPlugin()
  {
    quoteId = ApexPages.currentPage().getParameters().get('id');
  }

  public String getProductSoqlFragment()  
  {         
    return  ' Retired__c != \'Yes\'';
  } 

  public String getRatePlanSoqlFragment()  
  {      
    return  ' Retired__c != \'Yes\''; 
  }
}

 

 

2) Then Register this class zCustomProductFilterPlugin in the Component Registraion Section

 

Capture.PNG

 

Ref: https://knowledgecenter.zuora.com/CA_Commerce/I_Development_Resources/C_Component_Library/B_Global_C...



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Highlighted

Re: Using Filter Plugin to filter out products and Rate Plan

Hey Doyeli,

 

Thanks for posting the solution. Can I just confirm that the IFilterPlugin does not apply if we are using CPQ? I have been trying to get this to work in our sandbox org, but without any success ...

 

According to this: https://knowledgecenter.zuora.com/CA_Commerce/I_Development_Resources/C_Component_Library/B_Global_C...