Handlebars Helper Function: claimRow

Returns the first unclaimed row from a marketing object and updates that row to indicate that it’s claimed. Use this helper to distribute values such as coupon codes.

This helper is available in the Winter ’27 release of Marketing Cloud Next.

ParameterTypeDescription
objectStringRequired. The name of the marketing object that contains the rows to claim. Specify as a named parameter.
claimColStringRequired. The column that tracks whether a row is claimed. Specify as a named parameter with the value equal to the column name.
CLAIMANT_DATAStringRequired. The column to populate with data about the user claiming the row. Specify the name of the column as a named parameter, and set the value of the parameter to the value to populate in the claim table.

You can update multiple columns in the marketing object by appending more CLAIMANT_DATA="CLAIMANT_DATA_VALUE" pairs to the function.

The function returns the claimed row, or throws an exception if there aren’t any unclaimed rows.

This example claims a coupon code from the CouponCodes marketing object for a subscriber and marks that code unavailable to other subscribers. It returns the value from the CouponCode column in the marketing object. Before the helper runs, the marketing object contains these rows.

CouponCodeEmailAddressIsClaimed
S5MY7BVUfalse
40PNCHO2false
718BZOY0false

This example produces this output:

The helper updates the CouponCodes marketing object. After this operation, the marketing object contains this data.

CouponCodeEmailAddressIsClaimed
S5MY7BVUsunhi.kim@example.comtrue
40PNCHO2false
718BZOY0false

If there aren’t any unclaimed rows in the marketing object, the function throws an exception. For this reason, it’s helpful to combine this function with fallback. This example shows how to combine these functions.

If there are no unclaimed coupon codes remaining, the value of CouponCode is null. In this situation, the function returns the fallback code, “10OFF100”.