function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Robert WynterRobert Wynter 

Ampscript attachment using data extension to determine which PDF file to attach

Trying to switch out the static attachment in an email to dynamic based on a Data Extension(DE).

The Static:
%%[
%%=AttachFile("FTP","AIDI.pdf")=%%
]%%

And what I'm tried to replace it with:

%%[ var @Program,@ColumnProgramCode  set @ColumnProgramCode = Lookup("Program_Interest_G", "ProgramCode", "ProgramOfInterest", @Program)]%%
%%[
%%=AttachFile('FTP',%%@ColumnProgramCode%% +'.pdf')=%%
]%%

The DE is Program_Interest_G
the filed name is ProgramCode
Best Answer chosen by Robert Wynter
NagendraNagendra (Salesforce Developers) 
Hi Robert,

Please try this.
%%[ var @Program,@ColumnProgramCode , @file set @Program =v([Lead:Global_Program_of_Interest_2__c]) set @ColumnProgramCode = Lookup("Program_Interest_G", "ProgramCode", "ProgramOfInterest", @Program) SET @file = Concat(@ColumnProgramCode, '.pdf') ]%%

%%[IF NOT EMPTY(@file) THEN]%%

%%=AttachFile('FTP',@file)=%% 

%%[ENDIF]%%
Kindly mark this as solved if it's resolved.

Thanks,
Nagendra
 

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Robert,

Please try this.
%%[ var @Program,@ColumnProgramCode , @file set @Program =v([Lead:Global_Program_of_Interest_2__c]) set @ColumnProgramCode = Lookup("Program_Interest_G", "ProgramCode", "ProgramOfInterest", @Program) SET @file = Concat(@ColumnProgramCode, '.pdf') ]%%

%%[IF NOT EMPTY(@file) THEN]%%

%%=AttachFile('FTP',@file)=%% 

%%[ENDIF]%%
Kindly mark this as solved if it's resolved.

Thanks,
Nagendra
 
This was selected as the best answer
Robert WynterRobert Wynter
Problem Resolved
Robert WynterRobert Wynter
Problem resolved