Library Functions

Overview

The BML Function Library enables the user to write efficient and reusable custom BML functions. The user can write and store BML functions in a central library and call these functions from different areas in CPQ.

Administration

ClosedUsing Library Functions in Configuration BML Watch Video  Video icon

Once a Util Library Function has been defined, it's available for use in the Library Function(s) tab within the Function Editor.

  1. Click Add Functions to choose from a list of Util Functions. A pop-up dialog will open.

    Function Editor

  2. Click one or multiple Util Functions.

    Util function checkboxes

  3. Return to the Util functions area and make sure you've deployed your function(s) if desired function does not appear.

ClosedUsing Library Functions in Commerce BML Watch Video  Video icon

When you click Define Function in Commerce, a window will appear asking you to select attributes.

You can select System Variable Name, Variable Name for (Transaction), Variable Name for (Transaction Line), and Library Function(s).

Commerce BML function Editor

You can add Util and Commerce Library Functions by clicking the Reselect button within the BML Function Editor.

ClosedAdding a Library Function Watch Video  Video icon

  1. Click Add Function.
  2. Choose desired function from the drop-down.
  3. Select the square icon to preview the function in the pane to the right.
  4. Select the blue arrow to insert the function into the Script Definition Area.

    Add Preview Function to script definition area


ClosedAdding a Commerce Library Function Watch Video  Video icon

  1. Navigate to Admin > Commerce and Documents > Process Definition > Process .
  2. Select Library Functions for the appropriated document, and then click List.

    Document List, select Library Functions

  3. Select Add to create a new commerce library function.
  4. Create a Name, Variable Name, Description and choose a Return Type.

    The Variable Name field populates automatically. Variable names can only contain alpha-numeric characters and underscores. The entry can be changed before saving, but after saving the value is read-only.

  5. Select Add in the Parameter(s) section if the function requires parameters. Pick a parameter name and choose a data type.
  6. Reference the parameter in the library function with the name that you specify here.

    Library function Name property

  7. Select Add Attributes to access the main document attributes in the Main Document Attribute section.

    Add Main Document attributes

  8. Select Add Attributes to access the sub-document and the system attributes in the Sub-Document Attribute and System Attributes sections.

    The Main Document, Sub-Document and System Attributes sections are only available in the Commerce Library Editor. They are not available in the Util Library Function.

ClosedAdding a Util Library Function Watch Video  Video icon

  1. Navigate to: Admin > Developer Tools > BML Library.
  2. Click Add.
  3. Create a Name, Variable Name, Description and choose a Return Type.

    The Variable Name field populates automatically. Variable names can only contain alpha-numeric characters and underscores. The entry can be changed before saving, but after saving the value is read-only.

  4. Add the necessary parameters.

    Steps to add parameters

  5. Create your script, adding attributes as necessary.

    Create script

  6. Select Add to make your new library function available for use.

ClosedAdding a Function to Function Calls

Util and Commerce Library Function Editors use Function to Function calls. Function to Function calls allow admins to compartmentalize BML when dealing with complicated configuration or quoting scenarios. This feature will assist with the organization of BML and provides a solution to the compiled Java class size-limit issue. Function to function calls mimic the behavior of a Modify function calling a Library function.

  1. Open the Function drop-down.

    Library Functions - Function drop-down

  2. Select a Library Function to Insert into BML. The options are:
    • Commerce Library functions: Only available in Commerce Library Function Editors. Commerce Library functions may only be called by Commerce Library functions.
    • Util Library functions: Available in both Commerce and Util Library Function Editors.
  3. Once the function is viewed using the Preview Function, click the Insert into BML blue arrow.
The Function to Function link appears on the Related Rules page. When it is referenced by other Utils it will be displayed on the Related Rules page.
Recursive validation is performed during the following for Util and Commerce Library Functions: Validate, adding, applying, or updating a function.

Util and Commerce Library functions cannot self-reference. Recursive calling of the same Util and Commerce Library functions will fail and result in a compilation error when called at any point in the reference chain. Util and Commerce Library functions will not appear in the Import list for themselves.


ClosedCopy BML Library Function Watch Video  Video icon

A Copy action button is available in Util and Commerce Libraries so that BML Library Functions can be copied and renamed. This allows admins to manage versions and build new functions based on existing ones.

  1. Navigate to one of the appropriate library
    • Util Library: Admin > Developer Tools > Library.
    • Commerce Library Functions:Admin > Process Definition > Documents > List > Transaction Level > Library Functions > List
  2. Select the BML function you wish to copy by clicking its corresponding checkbox.

    Select Commerce BML Library function

  3. Click Copy at the bottom of the page.

  4. Rename the function.

    Changes can be made to the copied function, since it is a new and independent function.

Notes

Library functions must be created before they can be added.

Notes:

  • Library functions can be created if there isn't a pre-defined function for what you are trying to accomplish.
  • Importing a main document Commerce Library Function which imports sub-doc attributes into a BML script on the sub-doc level, will force a loop over all line items.

Custom Variable Name Conventions

In Oracle CPQ 23D, CPQ adopted Oracle CX Sales variable naming conventions for custom items. When an administrator creates a new custom Commerce item, the "_c" suffix is appended to the variable name. The new naming convention for custom variable names provides more consistency for integrations with Oracle Sales.

Beginning in Oracle CPQ 24C, customers can submit a service request to disable the "_c" suffix on variable names for custom Commerce entities (Actions, Analytics, Attributes, Data Columns, Integrations, Library Functions, Rules, Steps, etc.). The "_c" suffix is enabled by default for standard and legacy Commerce processes.

  • Customers can submit a Service Request (SR) on My Oracle Support to disable the "_c" suffix on variable names for custom Commerce entities
  • When the "_c" is disabled, the "_c" variable name suffix will not be required for newly created custom Commerce entities.
  • Disabling the "_c" variable name suffix for custom Commerce entities will not change existing variable names.
  • The "_c" suffix setting will not impact existing variable names when cloning a Commerce process or migrating Commerce items. Target variable names will be the same as the variable names from the source Commerce process.
  • Commerce Library functions can call other Commerce Library functions. Commerce Library functions can call Util Library functions.

  • Util Library functions can call other Util Library functions. Util Library functions cannot call Commerce Library functions.

Related Topics

Related Topics Link IconSee Also