Currently, I have a file transfer and file import activity in my Automation. As part of this automation, I need to get the file name and number of records in the file for Audit purpose. Based on my research I see BASEFILENAME_FROM_TRIGGER could provide filename, but I am getting null value from it.

<script type="text/javascript" runat="server">

var automationCustomerKey = "31e9a62f-02f5-123-9337-0e4xyz-2f0bcc"
var uploadedFileName = Variable.GetValue('BASEFILENAME_FROM_TRIGGER');

var logDE = 'Log_DE';

DataExtension.Init(logDE).Rows.Add({"File_Name":uploadedFileName, "No_of_records": "2", "File_received_on_Date": "05-12-2023" });

  • 1
    Please update your question to include some details about what you've attempted up to this point. May 29 at 16:16
  • @AdamSpriggs - Added
    – user133411
    May 29 at 21:05

1 Answer 1


Unfortunately the substitution strings listed here can only be utilized in File Transfer and Import activities within FileDrop Automations. Anywhere else you use them, they will return null.

You could try the solution I put here that uses an undocumented API call to get history of the import to gather filename, but it comes with its own risks and some potential unexpected behaviors.

GET /automation/v1/imports/{{importActivityID}}/history
Host: {{subDomain}}.rest.marketingcloudapis.com
Authorization: Bearer {{auth_token}}
Content-Type: application/json

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .