In my AMPScript I am using LookUpOrderedRows to get the records.

%%[VAR @rows, @row
VAR @ShortDate, @Time, @AccountBalance, @CustomObjectKey, @NotificationBatchDispatchQueueKey, @AccountKey
SET @rows = LookupOrderedRows("DataExt", 1, "ColumnName desc", "ColumnName", Value)
IF RowCount(@rows) > 0 THEN

SET @row = Row(@rows, 1)
{My Custom Code in here}

RaiseError("No rows found", true)


If someone can guide me on how to capture the errored out rows into a data extension.

As per the documentation - RaiseError(1,2,3,4,5) - The fifth cardinal is a boolean value which indicates whether the function records information to data extensions before an error occurs, even if the process skips the subscriber. I am not able to understand which DE will it be writing the records to. The documentation doesn't says much.

I am looking for a working sample for writing all these errors out in to rows in a data extension.


1 Answer 1


We use InsertDE before the raise error to capture a specific error message for several cases. I've stripped out our specific variables/DEs, but the only thing you're missing is the InsertDE function before the RaiseError.

if RowCount(@rows) > 0 then
  /*code here*/
  /* Insert info into the custom error log */
  InsertDE("RaiseError_log", "content_name", @content, "email", @email, "error_message", @error_message)  
  /* After data is logged, use RaiseError() to skip the record */
  RaiseError(@error_message, true)

With that code, You'll create a DE named RaiseError_log that has three columns content_name, email, and error message. each error will create a new row with variables filling in the values (@content, @email, and @error_message).

Hopefully that helps!

  • 2
    Make sure to create the DE without a primary key, so it will accept every entry. (This will make it more difficult to sort, but otherwise you chance the possibility that the Insert could reach a duplicate). Other option is to include a unique ID as primary key like CONCAT(emailaddr, NOW()) or similar as each entry should be a different time. Commented Aug 16, 2017 at 12:49

You must log in to answer this question.

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