Support Article
Current DateTime does not display in section
Summary
The DateTime function displays the function name instead of the current Date and Time in section.
Error Messages
Not Applicable
Steps to Reproduce
- Create a section containing a property with a DateTime control
- Set the default value with the current DateTime function as below:
@(Pega-RULES:DateTime).CurrentDateTime()
- In the Presentation tab, use the Edit option as Read-Only. In the Read-Only value use 'Constant' and set the same function as below:
@(Pega-RULES:DateTime).CurrentDateTime()
- On the UI, the DateTime value did not display. Instead, the function displays as a string.
Root Cause
This behavior is as per Pega product design.
When the control is configured to Read-only (always) Constant, the Constant value (the string as it is without any resolution) is displayed. In this use case, the @(Pega-RULES:DateTime).CurrentDateTime() string is displayed, but not the Resolved value.
However, when the above configuration was run in the non-Template mode, the control fetches the value from the property that is bound to the control rather than displaying the Constant value. This property which is bound to the control may possess the current DateTime value always. Hence, the DateTime value is displayed in the non-Template mode. However, in the Template mode, the control picks and displays the mentioned constant string (in this case, @(Pega-RULES:DateTime).CurrentDateTime()).
Resolution
Perform the following local-change in both the Template and non-Template modes:
- In the Presentation tab, configure 'Read-only (always) with Property Value'.
- In the General tab, bind a DateTime time property reference and populate this value using a data transform to have the current DateTime (data transform > Set {propertyVariable} to @(Pega-RULES:DateTime).CurrentDateTime()').
Published August 15, 2019 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.