25 views

Description

Since Jakarta, if the 'current' variable is used/altered within an UI Macro, UI Policies no longer work.

I.e.:

<g2:evaluate var="jvar_something" expression="var current='foo';" />

Steps to Reproduce

Below is the steps on how to re-create the issue. There may be other ways to re-create this other than directly altering the current variable like this. 
 
1. On a Baseline Jakarta Instance navigate to "Maintain items" and open the "Blackberry" catalog item. 
2. Click "Try it" 
3. Notice that there is a Multiple Choice variable named "Is this a replacement for a lost Blackberry device ?" 
4. If you select "Yes" the Single Line Text variable named "What was the original phone number ?" appears. 
5. (The UI Policies are working as expected) 
6. Now open the UI Macro named "catalog_item" 
7. At the very bottom, right _above_ the line 
 
<g:inline template="catalog_ui_policy.xml" /> 
add the following line of code: 
<g2:evaluate var="jvar_something" expression="var current='foo';" /> 
 
8. Save the UI Macro and reload the Blackberry catalog item 
9. Notice that now the UI Policy is broken, the Single Line Text variable doesn't show up. 

Workaround

This is expected behaviour. By design the 'current' record for UI Policy to work needs to be the record on which the UI Policy is running.
You cant be changing current object on you will and expect the system to behave the same. Changing current, ref, __ref__ are never suggested and always discouraged. These variables control several things in the system.
Even in older releases, if you have dependent choices, changing current used to cause issues. Since Jakarta, there have been several additional UI Policies, and they are all dependent on the correct running object.
 

Related Problem: PRB1092999

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-04-11 02:51:48
Published:2018-04-11