UI Pages included in a Catalog Item as a variable result in the next error (browser javascript console) when trying to add the item to the cart:

Uncaught TypeError: Cannot read property 'innerText' of null


The error is thrown in "js_includes_doctype.jsx", line "var text = label.firstChild.innerText":

| getLabelOf: function (fieldName) {
| var fieldid = this.tableName + '.' + fieldName;
| fieldid = this.resolveNameMap(fieldName);
| var label = gel('label_' + fieldid);
| if (label) {
| var text = label.firstChild.innerText;
| if (!text)
| text = label.firstChild.textContent;
| return text;
| }
| return null;
| },

Indeed the label does not have a firstChild for UI Page variables.
The call stack shows that this function is called when the variable is set mandatory:

| Class.create.getLabelOf (js_includes_doctype.jsx?v=08-27-2014_1022&lp=Wed_Sep_17_06_21_51_PDT_2014&c=5_46:8570)
| Class.create.mandatoryCheck (js_includes_doctype.jsx?v=08-27-2014_1022&lp=Wed_Sep_17_06_21_51_PDT_2014&c=5_46:8522)
| Class.create.catalogOnSubmit (js_includes_doctype.jsx?v=08-27-2014_1022&lp=Wed_Sep_17_06_21_51_PDT_2014&c=5_46:8844)
| addToCart (com.glideapp.servicecatalog_cat_item_view.do?v=1&s…m_id=8f9a3d1681394d00d799616040d45dc1&syspar…:406)
| onclick (com.glideapp.servicecatalog_cat_item_view.do?v=1&s…m_id=8f9a3d1681394d00d799616040d45dc1&syspar…:384)

Probably we would need to skip the mandatoryCheck for this kind of variables, or in case we decide to make the check, make sure that firstChild is not null before trying to access it.


Set the variable "Mandatory: no"


There is a similar bug with UI Page and Macros not processing in service catalog when included as a variable: PRB580457
But that one is when "rendering" the variable.

Steps to Reproduce

Reproduced in Eureka Patch 4 Hot Fix 1

1) Go to System UI > UI Pages and crate a page containing the next in the HTML field:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div>Dummy text</div>

2) Create a Catalog Item
3) Add a variable to the item with the next values:
~ Type: UI Page
~ Mandatory: yes
~ UI Page: <select here the UI Page created before>
4) Back in the form of the Catalog Item click "Try It". Observe the text "Dummy text" in the cart item.
5) Click "Order Now"

~ Expected behaviour: the form moves to the next page (checkout)
~ Observed behaviour: the form does not move on and an error is observed in the browser javascript console:

Uncaught TypeError: Cannot read property 'innerText' of null


There is no workaround for this Known Error at this time.

Related Problem: PRB609223

Seen In

Eureka Patch 4 Hot Fix 1
Eureka Patch 5

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2017-05-11 06:33:31