I am trying to use attachfile ampscript in conjunction with date personalization string. Please see below steps:
1: Data Extract Activity which exports the data from data extension with the file name ContactDetails%%Year%%-%%Month%%-%%Day%%.xlsx
2: File Transfer Activity which puts it into the import folder.
3: I use the attach file function %%=AttachFile('FTP','ContactDetails%%Year%%-%%Month%%-%%Day%%.xlsx','ContactDetails%%Year%%-%%Month%%-%%Day%%.xlsx')=%%
However when I receive the email instead of attached file I get the same ampscript%%=AttachFile('FTP','ContactDetails%%Year%%-%%Month%%-%%Day%%.xlsx','ContactDetails%%Year%%-%%Month%%-%%Day%%.xlsx')=%%
Please note that attach file function is enabled for the account. When I test the attach file as %%=AttachFile('FTP','20180221_New_CRM_Unsubscribers_Extract.txt','ContactDetailsTest.txt')=%%
I get the attachment successfully. Is there a way to use %%Year%%-%%Month%%-%%Day%%
in attach file function.
Thanks