Preparing for Oracle CPQ 26A
इस पेज पर
Oracle CPQ release 26A changes how one BML function behaves and repeats Oracle's advice on custom JavaScript. This guide explains both changes, how CPQ DevKit™ for Oracle helps you find affected code, and how to fix it.
Source: Oracle CPQ 26A readiness notes, Upgrade and Testing Considerations.
1. BML find() and null values
What changed
Oracle's 26A notes say:
Beginning in Oracle CPQ 26A if there is a null value for a BML
find()string function, a runtime exception is returned. Customers will need to include validations for null values.
Oracle does not describe a switch to turn this off. From 26A, a script that passes a null value to find() stops with a runtime error instead of carrying on.
find(str, substring, [start], [end]) returns the position of substring in str (BML string functions). The values most likely to be null are ones read at run time, for example:
- a value read from a dictionary, a BMQL result or a JSON object
- a library function parameter that a caller can leave empty
getconfigattrvalue()for an attribute that does not exist, which Oracle documents as returning null (BML other functions)
How CPQ DevKit™ finds it
When you open or save a .bml file, CPQ DevKit™ checks every find() call and reports the string and substring arguments that could be null. The checks show in the editor and in the Problems panel with the code oracle-26a-find-null. Click the code to open Oracle's 26A notes.
| What the check sees | Level |
|---|---|
find(null, …) or find(…, null) | Warning |
A variable with no isnull() or == null check before the call | Information |
getconfigattrvalue(…) passed straight to find() | Information |
Text in quotes, such as find(name, "-")'s second argument, is never null and is not reported. A variable is not reported when an isnull(variable), variable == null, variable <> null or variable != null check appears earlier in the file or earlier on the same line.
The check reads one file at a time and cannot know what a caller passes in. Treat an Information result as "check this one", not as a confirmed bug.
To check every function at once, run Download BML Functions first, then open the files, or search the workspace for find( with Search Workspace Artifacts.
How to fix it
Check the value with isnull() before calling find(), and decide what the script should do when it is null:
color = get(attributes, "color");
if (isnull(color)) {
return -1; // or another value that makes sense here
}
pos = find(color, "-");
For a value you want to treat as empty text, such as a library function parameter, give it a default first:
// productName is a parameter of this util function
if (isnull(productName)) {
productName = "";
}
pos = find(productName, "Pro");
CPQ DevKit™ does not rewrite these calls for you. What a script should do with a missing value depends on your business logic, so each fix needs a person to choose it.
After fixing, use Validate Functions and Test Functions on your util library functions, and test commerce functions in the Oracle CPQ admin UI, on a non-production site that already runs 26A.
2. Custom JavaScript: use CPQJS APIs, not the page structure
What changed
Under "Custom JavaScript and CSS", Oracle's 26A notes say:
Customers are recommended to utilize the CPQJS APIs instead of manipulating the Document Object Model (DOM) structure or specific elements, classes or IDs.
If customers have added custom JavaScript that leverages the Document Object Model (DOM) structure or specific elements, classes or IDs, this customization should be thoroughly tested and may require refactoring.
The same notes say that an upgrade may change the page structure (DOM), and list changes from Oracle JET 17.1.0, which 25C and later use: some combobox and search-select arrows changed from <a> to <span>, table column headers have a new structure, and collapsible sections moved their expand link. Oracle also reserves .oj class names for JET.
What CPQ DevKit™ checks
CPQ DevKit™ does not check JavaScript files today, so there are no diagnostics for this change. To find code to review:
- Download your JavaScript and CSS with Download Files (and Download Global Branding for branding JavaScript).
- Use Search Workspace Artifacts to search for
document.querySelector,getElementById,getElementsByClassName,$(,jQuery(,.oj-and the element IDs or classes your scripts depend on. - Replace page lookups with the CPQJS APIs described in Oracle's JavaScript Customizations for JET UIs, and test every customization on a 26A non-production site.
Checklist
- Download BML functions and review every
oracle-26a-find-nullresult - Add
isnull()checks where a value can be null, and test the functions - Review custom JavaScript and CSS that reads or changes the page structure
- Test on a non-production site running 26A before production is upgraded