Question

Reading work object using rule utility function

Hi All,

I wanted to read some property inside a work object from a Rule-Utility-Function, is there any OOTB standard way?

Thanks,

Sudarsan M

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

Pega
April 11, 2017 - 5:35am

If you are trying to read a property from a work object then that means you are trying to extract the content from BLOB. So far I am not aware of a Rule-Utility-Function written to do this job, since it should be done by UDFs like pr_read_from_stream at database.

Best way is to expose the property from BLOB as a column, 'optimize for filtering' wizard can do that job for you. Else you can create a column with the name as same as defined on the property and mapping the appropriate column type to its relevant property type, once this is done at database you can run prpcUtils.bat commandline utility tool with the action as 'expose' by mentioning the class name (where the property resides) in the prpcUtils.properties file

 

 

April 11, 2017 - 11:07am

Click on "(i) > Engine API" from the developer portal, and in the doc that pops up, see class "Database".  The method you want is "open".   You can open the work object by handle, and then read a property with class "ClipboardPage", for example method "GetString" if it's a string property.

Sometimes what I do is first code it up as an activity, then peek at the "action > java" to see what java got generated, if my goal is to package the work into a java step or a rule-utility-function. (Are you sure you wouldn't be better off packaging into an activity rule instead of a function?)

The relevant lines you would put in the activity for reading a property, so that you can peek at the java would be something like:

                obj-open-by-handle

                Property-Set