Support Article

InvalidReferenceException when opening work objects

SA-27919

Summary



An InvalidReferenceException is observed on the screen when attempting to open a WorkObject.


Error Messages



com.pega.pegarules.pub.clipboard.InvalidReferenceException: The reference 1SomeRd.WSTE1-2 is not valid. Reason: unexpected character '1' at position 0, expected start of name or a dot
at com.pega.pegarules.data.internal.clipboard.PropertyReferenceImpl.initialize(PropertyReferenceImpl.java:2977)
at com.pega.pegarules.data.internal.clipboard.PropertyReferencePoolImpl.get(PropertyReferencePoolImpl.java:99)
at com.pega.pegarules.data.internal.clipboard.PropertyReferencePoolImpl.get(PropertyReferencePoolImpl.java:80)
at com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl.getIfPresent(ClipboardPageImpl.java:1202)
at com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl.getIfPresent(ClipboardPageImpl.java:1146)
at com.pegarules.generated.PropertyHasValue_071001_zdFGLsk9mhp6nBKze5mgRQ.PropertyHasValue07_10_01(PropertyHasValue_071001_zdFGLsk9mhp6nBKze5mgRQ.java:120)
at com.pegarules.generated.PropertyHasValue_071001_zdFGLsk9mhp6nBKze5mgRQ.invoke(PropertyHasValue_071001_zdFGLsk9mhp6nBKze5mgRQ.java:83)


Steps to Reproduce



Open WorkObject.


Root Cause



An issue in the custom application code or rules:

User uses wrong version of the method PropertyHasValue(), which throws an exception when the property value has a dot in it, but is not a valid property reference.


Resolution



Make sure to use the correct PropertyHasValue() method in the code. 
Following is the description:


 
1. PropertyHasValue(cp_Prop)
 
 
Label:                    Check if a property reference has some value
Returns:               boolean
Description:        Returns true if property has non-blank value.
 
Usage:
Note that since this function takes a property reference, the property already exists on the page. If you use this function from a Rule-Obj-Activity, the activity java generation will CREATE the property on the page. In most cases you will want to use the version of this function that takes a string.
 
Parameters:
cp_Prop               (ClipboardProperty):
 
 
2. PropertyHasValue(tools, strReference)
 
Label:                    Check if a string property reference has some value
Returns:               boolean
 
Description:

Returns true if property has non-blank value. Note that if you need to test for a property existing on the page but not necessarily having a value, use PropertyExists.

Usage:

Params: tools - context strReference - property reference like ".aString". Ensure  using the other version of this function that takes a clipboard property param because a java generated rule will then CREATE the property on the page when it calls this function.
 
In the second method, if a string has a dot (‘.’) in it, Pega considers it as a property reference and will throw an exception.

Try to use the first method in most scenarios, if not sure about the string value.

 

Published September 13, 2016 - Updated September 20, 2016

Have a question? Get answers now.

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