Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Wrong context for Declare Expression

SA-22031

Summary



Developer has two declare expressions for the same Property and Change class, but in different "Applies To" classes, My-Test-Class2 and My-Test-Class3

At run time, the declare expression of the other(My-Test-Class3) "Applies to" class is getting invoked although the page is set as this (My-Test-Class2) class.


Error Messages



Not applicable


Steps to Reproduce

  1. Create a Data class named PayInfo (Fringe-FW-PRPC61SP2FW-Data-PayInfo), create some properties within it, one of them is "myClassName" of type text.
  2. Create 2 Other Data classes as following with Parent set as different abstract class from PayInfo, but same parent.
     
    • Fringe-FW-PRPC61SP2FW-Data-Test-Class2
    • Fringe-FW-PRPC61SP2FW-Data-Test-Class3
       
  3. In both Class2 and Class3 define a page property named "payInfoDlgt" of class PayInfo.
  4. Create Declare Expressions in Class2 and Class3 for ".payInfoDlgt.MyClassName" target property. Leave the Page Context blank.
  5. In both the Declare Expressions rules execute the following steps
     
    • Select "Calculate Value" as "Whenever Used".
    • Select "Execute this Expression" as "regardless of any pages it is contained in"
    • In Class2, Set ".payInfoDlgt.MyClassName" = Value of "Class 2"
    • In Class3, Set ".payInfoDlgt.MyClassName" = Value of "Class 3"
       
  6. In the work class add Page property of type Class3
  7. Create a test Activity:
     
    • Create a "work" Page and Class3 Page using Page-New.
    • Use Property-Seek-Value to trigger the expression.
    • Inspect the value returned. It returns "Class 2", indicating that declare expression of Class 2 got invoked for a page of type Class3. This is incorrect behaviour.


Root Cause



A defect in Pegasystems’ code or rules.

Resolution



Apply HFix-26963.

Published April 13, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice