Date property format changes after wait shape in offer flow
User is using Pega 7.2.2 with Pega Marketing 7.22, and reported that the format of the Date property changes after adding a Wait shape to an Offer flow.
For example: the initial format set in the strategy is like "14 February 2018" but after adding the Wait shape the Date format changes to "2/14/2+".
Steps to Reproduce
- Create an Offer rule writing to a File template.
- Create the Offer rule with shapes sequence like Generic Treatment > Generic Treatment > Wait > Generic Treatment > Results.
- Make sure a campaign is writing a Date property as @CurrentDate("MMM dd yyyy","EST"). The Date written to file before Wait shape is like Feb 14 2018 but the format changes to Feb 14 + after the wait shape.
An issue in the custom application code or rules is identified as root cause.
Offer initiation and execution happens in memory up to the Wait shape. When the flow encounters a Wait shape then at that point, the Offer data properties are persisted to the backing Batch Output Table. Upon resumption from Wait shape, the data is loaded from the Batch Output Table and utilized.
So, if there are two File Output shapes - one before Wait shape, one after Wait shape and they both utilize PropertyA for output, the value of PropertyA in shape 1 (pre-wait) will be the same when it comes to memory - potentially, full date value calculated; but when the Wait shape is requested; PropertyA will get written to the database.
If the size of the PropertyA column is not big enough; it will get truncated and that is the value that will be loaded for shape 2 (post Wait shape) unless PropertyA is specifically recalculated post Wait shape.
Therefore, the date truncation seeing post wait shape is due to truncated value getting loaded from the table. In the batch output table, the column from where the date value is getting loaded would be of size Varchar(8) which is causing the issue. Use date property carefully as it can have unintended consequences.
Follow one of the below two approaches to resolve the issue:Option-A: When using a Wait shape in the offer flow and if there is a File Output shape post Wait shape that is formatting a Date property, then do not set more than 8 characters for a Date property in the Strategy. When limiting the Date property to 8 characters, it’s value does not get truncated while persisting of it to the Batch Output Table and as a result appropriate formatting will be applied as set in the Output template when the value is retrieved from the database for processing post Wait shape.
Option-B: Use DateTime properties instead of a Date property in Strategy when using a Wait shape in an Offer flow and if there is a File Output shape post Wait shape that is formatting a DateTime property.
0% found this useful