Posted: 12 Feb 2021 14:51 EST Last activity: 14 Feb 2021 18:26 EST
Reusable Date Formats
When displaying a date in the UI, you can choose the format to use. The dropdown provides around 10 or so OOTB formats. It also allows a "Custom" option, where you can then provide the format you want to use, like "MM-DD-YYYY".
It would be great if we could add to the drop down your own formats. Our client always wants to use the above custom format. So it would be great if we created that as a dropdown option for easy selection; and if there was a way to update that format in case they ever want to change the default format, which would then update all UIs that reference it; like any reusable rule.
It would be great if the pyDateTimeFormat property that currently seems to drive this at the moment had a technique for delivery teams to add a Prompt List item that mapped to a Field Value rule where the preferred datetime format can be changed once and take effect everywhere.
Specialize Embed-Control-Mode.pyDateTimeValue into a client ruleset
Add a new entry to the Prompt Value list for the specialized property:
Standard value: FieldValue-MyOrgPreferredDateTimeFormat
Prompt value: MyOrg's standard corporate format
UI's that want to forever use their organization's "standard format" for date/time will store FieldValue-MyOrgPreferredDateTimeFormat in the rule configuration.
At runtime when a format starting with FieldValue-* is found in the rule configuration, Pega should rule-resolve (from the current instance showing this field) the Field Value rule identified in the rest of the format (MyOrgPreferredDateTimeFormat).
Whatever format string is implemented in the resolved Field Value rule becomes what is passed to the DateTime APIs to format the date.
This allows the delivery teams to configure UI's to say show this date time according to a particular company standard, without hard-coding the current standard into the rule configuration at design-time. The standard date/time format can:
Adapt over time: Change one Field Value and all UI's that opted to 'subscribe' to this configuration observe the change
Adapt based on the situational layer cake: As rule-resolution is responsible for sourcing the the format to apply.