Cannot set a field to readonly over application scopes using a catalog client script


In New York patch 7 while calling g_form.setReadOnly in a catalog client script and using just the variable name across application scope the field does not get set to readOnly.

Example:  g_form.setReadOnly('test',true);

You will see the following error in the console:

VM11738:1 Uncaught TypeError: Cannot read property 'getScope' of undefined
at eval (eval at inScope (js_includes_ui16_form.jsx?v=04-10-2020_1401&lp=Tue_Apr_28_13_17_36_PDT_2020&c=34_797:12130), <anonymous>:1:38)
at inScope (js_includes_ui16_form.jsx?v=04-10-2020_1401&lp=Tue_Apr_28_13_17_36_PDT_2020&c=34_797:12130)
at ScopedGFormGenerator.scoped_g_form.setReadOnly (js_includes_ui16_form.jsx?v=04-10-2020_1401&lp=Tue_Apr_28_13_17_36_PDT_2020&c=34_797:12160)
at onLoad_6f142cdedb249010f281a6dc13961957 (
at js_includes_doctype.jsx?v=04-10-2020_1401&lp=Tue_Apr_28_13_17_36_PDT_2020&c=34_797:543
at runBeforeRender (js_includes_doctype.jsx?v=04-10-2020_1401&lp=Tue_Apr_28_13_17_36_PDT_2020&c=34_797:460)
at z_last_include.jsx?v=04-10-2020_1401:32
at z_last_include.jsx?v=04-10-2020_1401:38

This worked correctly in Madrid

Steps to Reproduce

1) Create a Catalog Item in Scope Say ServiceCatalog Rest API.
2) Have a variable in it created in the same scope of item.
3) Have a onLoad catalog client script in Scope ServiceCatalog Rest API.
4) Inside the above catalog client script try to make the variable of step 2 readonly.
5) Change your scope to ServiceCatalog Rest API and order the item created in step 1.
6) Open the RITM form.

You will see that the fields that you expect to be read-only are not.

Expected behavior - The fields should be set to read-only as per the catalog client script

Actual: The field is not made readonly.
Expected: The field should be made readonly as the scope of the catalog client script is same as that of the variable.


While passing field name to the g_form setReadonly API prefix the field name with 'variables.'


Ex: g_form.setReadonly('test', true) should be changed to g_form.setReadonly('variables.test', true) where 'test' is the name of the variable on the item with which the request item is generated.

Related Problem: PRB1401078