Posted: 9 Nov 2017 14:06 EST Last activity: 11 Nov 2017 15:57 EST
Adding a Created Date Field in a Data Table
Is there a way to add a field in a Pega Data Table that will display the date of creation of a record in a data table? For instance, when a record is added to a table the record should have a 'Created Date' read only value that displays just the date of creation of said record, not the date and time.
I meant to say data type in Pega 7.2. I've attached some screenshots for your reference. Basically, I just want the created date field to display the current date in the format "mm/dd/yyyy" indicating that the record was added to the data type on that date.
I've set up a declarative expression to accomplish this, but I can't quite get the function right. It's displaying in the format yyyymmdd, but as mentioned I want it to appear as mm/dd/yyyy.
Can you share the screen shot of change tracking. There are some known issues with formatting of date readonly property when certain options are selected in change tracking. In tracer see if getTargets activity is getting called. If it is getting called you might face this format issues.
The pxCreateDateTime should be automatically populated using Pega local storage. This is given an initial value and will not change on subsequent edits of the record.
This is stored as a DateTime in Pega (and therefore as the relevant Date type in your DB) - When displaying this field you can configure formatting as appropriate - For example, using a Date Time control you can configure your requested format.
If your use case really does require a new property, the example Mahesh has provided will suffice, with an additional check to ensure the value is only updated if no value already exists (i.e. it is a new record). I would stress, however, that adding this unnecessarily will ultimately make your application more difficult to maintain.