Campaign Standard: How to concatenate a text string and a date function in the “Output file”

Description

It has been asked if it is possible to concatenate a text string and a date function in the “Output file” of a workflow “Extract file” activity. The use case for this is that the daily file needed to be updated with a specific date and format every day.

Resolution

To resolve this a content block should be created with the formatDate() function. Below is an example of this method.

%
var now = new Date();
var sToDisp = now.getFullYear() + (“0”+(now.getMonth()+1)).slice(-2) + (“0” + now.getDate()).slice(-2);
document.write(sToDisp);
%
In this content block, formatDate() is available

Then in the extraction file activity, open the “Edit” file name (Pencil icon on the right side of the file name field) and add a Content block in the file name.

On this page