Pagination Solution in Oracle CPQ   

 Business Requirement:

When a salesrep is configuring a quotation (which ultimately results in quotation line items), there is a need to display addon/support products or assets which the salesrep will choose to complete the configuration workflow.

The number of addon/support products or assets that can be displayed may vary from 0 to any number of records.

Standard Solution :

Oracle CPQ provides a native datatype called ArraySet that can hold up to 200 elements. Values in an Arrayset are displayed as a HTML table to the salesrep in the configuration section. However, the ArraySet does not support pagination or search/filter capabilities to address usability concerns.

Customized Solution:

Standard Config Attributes :

  1. TextArea Attribute (hidden) : Delimited String that holds addon/support products or assets data (productsDelimitedString). Write a recommendation rule that will populate this data either from data table or SFDC or any other source. This rule should run only once for that configuration workflow by the salesrep.
  2. Two HTML Attributes : “NEXT” and “PREVIOUS” buttons (action).
  3. Text Attribute : to track the current page number (currentPageNumber). Write a recommendation rule to set this page number based on which button user has clicked. In case of NEXT, the page number needs to be incremented and for PREVIOUS it needs to be decremented.
  4. ArraySet  Attribute : that displays addon/support products or assets data
  5. Single Select Menu : to choose the number of records to display per page(recordsPerPage)

Custom library function :

getProductDataForCurrentPage(productsDelimitedString, currentPageNumber, recordsPerPage): This library function takes Product/Asset data  (a delimited string), the current page number and records per page and splits the data to get the right records based on the current page number.

Sample Input String : [Formatted for readability]

1##Item SKU:001##List Price:150##Qty:1$$2##Item SKU:002##List Price:300##Qty:1$$3##Item SKU:004##List Price:200##Qty:1$$4##Item SKU:005##List Price:250##Qty:2$$5##Item SKU:005##List Price:600##Qty:1$$6##Item SKU:006##List Price:150##Qty:1$$7##Item SKU:007##List Price:300##Qty:1$$8##Item SKU:008##List Price:300##Qty:1$$9##Item SKU:009##List Price:350##Qty:1$$10##Item SKU:010##List Price:880##Qty:1$$11##Item SKU:011##List Price:390##Qty:1$$12##Item SKU:012##List Price:30##Qty:1$$13##Item SKU:013##List Price:356##Qty:1$$14##Item SKU:014##List Price:820##Qty:1$$15##Item SKU:015##List Price:3900##Qty:1$$16##Item SKU:016##List Price:110##Qty:1$$17##Item SKU:017##List Price:320##Qty:1$$18##Item SKU:018##List Price:290##Qty:1$$19##Item SKU:019##List Price:370##Qty:1$$20##Item SKU:020##List Price:220##Qty:1$$

Sample Output String for currentPageNumber =2, recordsPerPage =5:

6##Item SKU:006##List Price:150##Qty:1$$7##Item SKU:007##List Price:300##Qty:1$$8##Item SKU:008##List Price:300##Qty:1$$9##Item SKU:009##List Price:350##Qty:1$$10##Item SKU:010##List Price:880##Qty:1$$

code

Javascript on NEXT and PREVIOUS Buttons:

A Html button is created in Oracle CPQ as below in the default of an attribute.

jsnextbutton

 

 The following javascript code in the config.js file is invoked while clicking the NEXT or  PREVIOUS html buttons. This  will enable the system to run the pagination code to display the next set of records.

nextjscode

Workflow :

  1. Salesrep clicks on Add Line Items, the system navigates to the config page
  2. First time the products are displayed with a default number of records per page
  3. The user can choose the number of records per page with the following select box.perpagerecords
  4. The system executes the function recordsForCurrentPage at the back-end and then displays the returned string in an array set as follows:

firstpageinarrayset

5. The user can navigate to the next page by clicking the NEXT button.

previousnextarrayset6. To make the pagination more effective, we can also add other functionalities like search/filter on top of this pagination logic.