I have an issue with the ClaimRow() function added to an email part of a journey running from a Data Extension entry with 150 contacts. Each contact supposed to receive a unique URL pulled from DE with 150 unique URLs but instead only 3 promo links were assigned to 3 contacts. Does anyone have experiences something like this when using the function for a batch send or DE sends?

Here is the scenario:

The journey has a simple DE entry with 150 contacts imported manually and was activated to run once at specific date/time then sending a simple email.

During the QA before the send, I ran multiple tests of a single sends and the ClaimRow function was working as expecting and clamming the next available row each time I call it.

I've been using this function in another journey which trigger based on SF data not on a batch send (DE entry) and I don't have any issue. I've checked the email tracking data to investigate further and I noticed that few of the contacts that clicked on the CTA received the same URL instead of unique as I was expecting. When I looked into the DE contacting the URLs, I saw that only 3 rows were claimed which looks to me that the very first emails that were send by MC were captured and received unique URL and the rest received duplicates of those same 3 URLs already claimed.

I ran additional test to replicate the journey with 10 test contacts and DE with 10 unique URLs and upon sending this is exactly what happened as I mentioned above. I received 10 emails with only 2 unique URLs assigned and I saw that only 2 rows were claimed from the ClaimRow DE.

I feel that using this function with a batch send caused some sort of error of confusion and only the very first 2-3 contacts received unique promo url.

Here is example of the code I used:

/* Check for available URLs in Data Extention 'Redeem_URLs' */

var @rows, @rowCount
SET @Rows = LookupRows("Redeem_URLs", "IsClaimed", "False")
SET @RowCount = rowcount(@rows)

IF RowCount(@Rows) >0 


/* Redeem URL and update the DE */   

var @ContactKey, @RedeemURL, @ClaimedDate

set @ContactKey = AttributeValue("ContactID")

if (not empty (@ContactKey)) THEN

set @RedeemURL = Lookup("Redeem_URLs", "RedeemURL", "IsClaimed", "false") /* Retrieve the next available URL */   
set @ClaimedDate = Now(1)

UpdateDE("Redeem_URLs", 1, "RedeemURL", @RedeemURL, "IsClaimed", "true", "ContactKey", @ContactKey, "ClaimedDate", @ClaimedDate) /* Claimed URL will be updated with ContactID and Date */   


Reedem URL: %%=RedirectTo(@RedeemURL)=%%

The AMPscript was added in the beginning of the HTML template and the output inserted into CTA block and also hyperlink (inserted in two places inside the HTML). Here is example of the html codes with the variable:

Email CTA:

                            <td align="center" valign="middle" class="mcnButtonContent" style="font-family: &quot;Open Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 18px; padding: 12px;">
                                <a class="mcnButton " title="CLAIM YOUR MEMBERSHIP" href="%%=RedirectTo(@RedeemURL)=%%" target="_blank" style="font-weight: normal;letter-spacing: normal;line-height: 100%;text-align: center;text-decoration: none;color: #222222;">CLAIM YOUR MEMBERSHIP</a>

Email Text URL:

<strong>As part of your membership, we will now fund a <a href="https://www.youtube.com/watch?v=xxxxxx" target="_blank">rewilding membership with XXX</a> on your behalf. <a href="%%=RedirectTo(@RedeemURL)=%%" target="_blank"><u>All you have to do is claim your profile</u></a>.</strong><br>

Example of the Coupon DE:

enter image description here

enter image description here

  • 2
    where are you calling the claimrow function? I don’t find it in the code above. It seems that you’ve tried to implement it from scratch. Here is an example of how to use it: ampscript.guide/claimrow Commented Dec 5, 2022 at 14:31
  • Also, please update your question to include the schema and data sample of your coupon DE. Commented Dec 5, 2022 at 14:45
  • 1
    Sure, I've provided an adapted example accordingly in my answer below. Using lookups will not solve your problem anyway because it does not lock the row; hence, the same row can be pulled and sent to multiple contacts... Commented Dec 5, 2022 at 15:19
  • 1
    Also, please see salesforce.stackexchange.com/a/336168/36623 - where Gortonington explains an alternative (SQL based) approach to claimrow function Commented Dec 5, 2022 at 16:15
  • 1
    @NikolayNikolov the answer to your first question is yes. Claimrow will return the same url based on the contactid as you said. I assume that a contact can be only once in your source data extension, otherwise you need to handle the case where a contact were assigned multiple coupons differently.. Commented Dec 5, 2022 at 17:28

1 Answer 1


Putting my comment here for more visibility.

It seems that you are trying to implement the function from scratch. Claimrow is a function that already exists.

Claimrow function returns a row from a data extension and locks the row to prevent the information from use in another context until the row claimed status changes. If the function finds a row with the correct matching set of keys, the function returns those values. If the function finds no claimed row, the function sets key values in an unclaimed row and returns that row.

Also, I've used it a lot with batch sends without any problem.

Here is an example taken from the ampscript.guide and adapted to your use case:

if _messagecontext == "PREVIEW" then
    set @redeemURL = "XX TEST XX"
    /* include the send context attributes or columns to record here */
    set @ContactKey = AttributeValue("ContactID")
    set @ClaimedDate = Now(1)
    set @urlRow = ClaimRow("Redeem_URLs", "IsClaimed", "ContactKey", @ContactKey, "ClaimedDate", @ClaimedDate)
    if not empty(@urlRow) then
      set @redeemURL = Field(@urlRow , "RedeemURL")
        /* You can do other error handling here */
        /* This aborts the entire send */
        RaiseError("No URLs available", false)

redeemURL : %%=v(@redeemURL)=%%


You must log in to answer this question.

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