---
schema_version: "1"
id: 4b707cc620dff8e1a89bedb1e1457e09dfcbafa2431cd71315a63b7a707daa17
title: "Handlebars Helper Function: claimRow"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/data/mcn-handlebars-reference-data-claimrow.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-claimrow.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2b4a8031d23229b12b9bca152fba2c2cb28128f81a4197341b7f12f2d1435637
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# 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.

## Availability

This helper is available in the Winter ’27 release of Marketing Cloud Next.

## Syntax

```handlebars
{{claimRow object=MARKETING_OBJECT_NAME
  claimCol=COLUMN CLAIMANT_DATA="CLAIMANT_DATA_VALUE" ...}}
```

## Parameters

| Parameter       | Type   | Description                                                                                                                                                                                                      |
| --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `object`        | String | Required. The name of the marketing object that contains the rows to claim. Specify as a named parameter.                                                                                                        |
| `claimCol`      | String | Required. The column that tracks whether a row is claimed. Specify as a named parameter with the value equal to the column name.                                                                                 |
| `CLAIMANT_DATA` | String | Required. 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.

## Return Value

The function returns the claimed row, or throws an exception if there aren't any unclaimed rows.

## Usage Example

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.

| CouponCode | EmailAddress | IsClaimed |
| ---------- | ------------ | --------- |
| S5MY7BVU   |              | false     |
| 40PNCHO2   |              | false     |
| 718BZOY0   |              | false     |

```handlebars
{{#set emailAddress}}sunhi.kim@example.com{{/set}}

{{#with (claimRow object="CouponCodes" claimCol="IsClaimed" EmailAddress=emailAddress)}}
  Your coupon code is {{CouponCode}}
{{/with}}
```

This example produces this output:

```text
Your coupon code is S5MY7BVU
```

The helper updates the `CouponCodes` marketing object. After this operation, the marketing object contains this data.

| CouponCode | EmailAddress          | IsClaimed |
| ---------- | --------------------- | --------- |
| S5MY7BVU   | sunhi.kim@example.com | true      |
| 40PNCHO2   |                       | false     |
| 718BZOY0   |                       | false     |

## Providing a Fallback Value

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](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md). This example shows how to combine these functions.

```handlebars
{{#set emailAddress}}sunhi.kim@example.com{{/set}}

{{#with (claimRow object="CouponCodes" claimCol="IsClaimed" EmailAddress=emailAddress)}}
  Your coupon code is {{fallback CouponCode "10OFF100"}}
{{/with}}
```

If there are no unclaimed coupon codes remaining, the value of `CouponCode` is null. In this situation, the function returns the fallback code, "10OFF100".

## See Also

- [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md)
