Posted: 15 Mar 2018 16:19 EDT Last activity: 13 Jun 2018 7:42 EDT
OOTB function pxDoesHandleExist fails if parameter passed is not a valid handle
The built-in pega function 'pxDoesHandleExist' returns 'true' if the handle exists, as expected.
However, if the parameter passed is 'garbage,' for example - the function fails rather than returning 'false' - with the message "
Class GARBAGE does not exist
This does not fit with the use case given in the help file - where this function is meant to be used as a precondition for obj-open-by-handle so we can avoid trying to open a nonexistent instance of a rule.
The funciton returns true if an object with the given handle exists, false otherwise. If an error is encountered checking for the object, a runtime exception is thrown.
Below is the documentation for "doesInstanceExist" (you can view it from the Pega developer portal with > engine api > Database class). Based on this, if an error is encountered, you will get an exception instead of a boolean "false" return.
If you open Function "pxDoesHandleExist", under History tab, Usage: "Returns true if an object with the given handle exists, false otherwise. If an error is encountered checking for the object, a runtime exception is thrown."
If this Function never returns a false for an un-valid handle, please go ahead to raise a SR. We will do further research on this and decide if online help for this needs to be modified.