I'm trying to create a notification email for admin purposes to notify me when an import doesn't run for a particular day (in short if a file wasn't pushed to the FTP server).

I was thinking that it would be easy just using RetrieveRequest but it doesn't work:

  Set @rr = CreateObject("RetrieveRequest")
  SetObjectProperty(@rr, "ObjectType", "ImportResultsSummary")
  AddObjectArrayItem(@rr, "Properties", "TotalRows")

  Set @automationList = InvokeRetrieve(@rr, @statusOutput, @requestId)

I've tested this type of request in Python and it works fine, I get my results but AMPScript is being difficult for some reasons.

Any clues why this is not working?

Thanks for your help.

1 Answer 1


Well, I decided to go the long way instead because I couldn't make it work in a email content.

I made it work in SSJS in a Landing Page but it wouldn't do anything in a Script object.

So the long way I'm using is when the Automation for the Import is triggered, I run a query at the to insert in a Data Extension the name of the Import and a date. Then from the Email Content I can easily access the Data Extension and figure out if an Import is missing for the day.

Here is the code I used in the Query:

SELECT CONVERT(VARCHAR(8), GETDATE(), 112) 'EventDate', 'Digital' AS 'Group', 'Digital_Audience' AS 'Name'

And the code in the Email Content:

  /* Retrieve Data Extension Rows for today only */
  Var @today, @rows, @importCount, @name, @foundAudience, @foundBehaviour, @foundPreference
  Set @today = Format(Now(), 'yyyyMMdd')
  Set @rows = LookupRows("All_Imports", "EventDate", @today, "Group", "Digital")
  Set @importCount = RowCount(@rows)

  If @importCount == 3 Then
    /* Silent Error to stop the email from being sent - it won't error in the Automation */
    RaiseError("Nothing to report today.", true)
  ElseIf @importCount > 0 Then
    For @i = 1 To @importCount Do
      Set @rs = Row(@rows, @i)
      Set @name = Field(@rs, "Name")

      If @name == "Digital_Audience" Then
        Set @foundAudience = true
      ElseIf @name == "Digital_Behaviour" Then
        Set @foundBehaviour = true
      ElseIf @name == "Digital_Preference" Then
        Set @foundPreference = true
    Next @i

You must log in to answer this question.

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