contentstatus.contentlastmodified and db publish

This question was asked in the old forum. I thought I’d post the answer here as well:

How do I publish the value of contentstatus.lastmodified using db publishing? It 5.7 it was as simple as mapping the content status table to the target db’s row. Now I can’t get to the contentstatus table. The interface is getting in the way.
In Rhythmyx 6.0 and 6.1, you have to use the PSOToolkit to obtain the PSComponentSummary. You can get the latest Toolkit from Tech Support. Unzip the distribution into a temporary directory and follow the instructions in the readme file.

Once you have done this, you can add a binding to your DB Publishing template:

$lastModifiedDate = $user.psoObjectFinder.getComponentSummary($sys.item.getGuid()).getContentLastModifiedDate()

This returns a java.sql.Timestamp object. You can turn it into a string suitable for inserting into a database with “toString()”, or use one of the simple date formatters. Also look at the Velocity tools website:

http://velocity.apache.org/tools/releases/1.3/generic/

You can use any of the $tools.date.format() methods as documented there to reformat the date any way that you like.

Other values in the PSComponentSummary can be accessed in a similar manner. The Rhythmyx JavaDoc installed with your Workbench provides a complete description of this class, but it contains all of the values found in the CONTENTSTATUS table.

In Rhythmyx 6.5, these values will be available directly in the Properties of the item.