Hi,
You can refer below code for renaming the attachment file name.
Note : Here i am takign dialog caption as the new file name you can change it as per your requirement.
printSettings = formLetterReport.getCurrentPrintSetting().parmPrintJobSettings();
filenameLoc = printSettings.fileName(); //taking the attachment file name
if(filenameLoc)
{
//getting the directory path based on the file name
directory = System.IO.Path::GetDirectoryName(filenameLoc);
//Combining the dialog caption and directory)
filenameFinal = System.IO.Path::Combine(directory,strFmt("%1.%2",this.parmDialogCaption(),printSettings.fileFormat()));
//checking if file exists with the file name then overriding , creating if it doesnt exist.
if(!WinAPI::fileExists(filenameFinal))
{
WinAPI::createFile(filenameFinal);
printSettings.fileName(filenameFinal);
}
else
{
printSettings.fileName(filenameFinal);
}
}
Thanks