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
- Create a Data class named PayInfo (Fringe-FW-PRPC61SP2FW-Data-PayInfo), create some properties within it, one of them is "myClassName" of type text.
- 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
- In both Class2 and Class3 define a page property named "payInfoDlgt" of class PayInfo.
- Create Declare Expressions in Class2 and Class3 for ".payInfoDlgt.MyClassName" target property. Leave the Page Context blank.
- 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"
- In the work class add Page property of type Class3
- 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
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.