I'm wanting to insert a row in a Data Extension (DE) exactly once per email send using AMPScript -- without using a lookup.

The best I've been able to do is limit the upserts to the first Batch ID using the _JobSubscriberBatchID personalization string.

In analyzing tracking data, I've noticed that all non-triggered send jobs are separated into batches and numbered sequentially starting at 1. The batch sizes range from 50 to 500 emails. So at most this operation would be done 500 times.


if _JobSubscriberBatchID == 1 then

  /* upsertDE() function goes here */



Anyone have a better way to go about this?



Have you maybe tried making it work with

%%before; httpget; 1 "http://URL_TO_CLOUD_PAGE"%%

and then create a Cloud Page with the InsertData AMPScript function?

| improve this answer | |
  • I know about _messagecontext. That's not what I'm trying to do. – Adam Spriggs Jun 14 '17 at 20:44
  • @AdamSpriggs Updated the answer, maybe something like what I've outlined would help? – Amtera Mar 6 '18 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.