Hi,
Trying to reassign value to a detial date field in an action step after mapping.
I am mapping a field that occationnally is blank. I can default it to some value as follow.
Then in the action I loop through the detail records to set the defaulted date field to the value of the previous detail record but the assignement is not working I tried multiple type of assignement and nothing is working.
Can you also please share a screenshot of the Date Format settings you are using? These settings can be found in the Step Properties (panel) of your Extraction Step or – in case the option Automatic is selected – via: Window > Preferences… > (Preferences window) > DataMapper > Default Format
Create a Record property named lastDate, of type Date, and initialize it to null;
In your Repeat loop, start with a condition to see if a date is present.
In the True branch:
Extract your Date field as usual. Set the Date/Time format to Automatic.
Add an Action step that sets the lastDate property to the same extracted value.
In the False branch:
Add an Extract step for the Date field, set it to JavaScript with the following code:
sourceRecord.properties.lastDate || new Date();
This will use the last date you extracted as the date for any line item that doesn’t have a date. In case the very first item does not have a date, then the date will be set to today’s date.