Support Article
InvalidReferenceException when calling entrySatisfiesCondition
SA-52132
Summary
When passing an expression (as in the below example) to a function call, the selectorExpression and propertyCollection values are set incorrectly and InvalidReferenceException occurs. The selectorExpression is set to '?' instead of the Index value.
SomePage.SomeList(selectorExpression).somePage.propertyCollection().someValue
For example,
Consider the below expression.
@(Pega-RULES:ExpressionEvaluators).entrySatisfiesCondition(TestPage.pxResults(Param.Index).pxResults().pyLabel, "=", "<current-value>", "ANY")
Error Messages
com.pega.pegarules.pub.clipboard.InvalidReferenceException: The reference TestPage.pxResults(?).pxResults().pyLabel is not valid. Reason: unexpected character '?' at position 19, expected subscript
Steps to Reproduce
Call an expression with a data structure such as the following:SomePage.SomeList(selectorExpression).somePage.propertyCollection().someValue
Root Cause
The code cannot handle the selectorExpression and propertyCollection values when passed together as in the below expression. A custom function can be used to breakup the expression such that it is passed correctly.
SomePage.SomeList(selectorExpression).somePage.propertyCollection().someValue
Resolution
Perform the following local-change: 1. Create a function in a custom library. Select a name for the use case.
ClipboardPropertyCollection F11(ClipboardPage context, String expression, PublicAPI tools) {
return ((PegaAPI) tools).propertyReferenceFilter(expression, context, PropertyInfo.MODE_STRING);
}
return ((PegaAPI) tools).propertyReferenceFilter(expression, context, PropertyInfo.MODE_STRING);
}
2. Use the new function when referencing entrySatisfiesCondition.
The actual Property-Set used for testing.
Param.Test = @(Pega-RULES:ExpressionEvaluators).entrySatisfiesCondition(TestPage.pxResults(Param.Index).pxResults().pyLabel, "=", "<current-value>", "ANY")
The Property-Set with the new function.
Param.Test = @(Pega-RULES:ExpressionEvaluators).entrySatisfiesCondition((@CustomLibrary.F11(TestPage.pxResults(Param.Index), ".pxResults().pyLabel", tools)), "=", "<current-value>", "ANY")
An enhancement request is submitted to review the functionality in a future release.
Published April 15, 2018 - 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.