Give reward by name
Give Reward by Name
Description
The action is used to give a reward to a member by name.
Parameters
| Parameter |
Type |
Format |
Description |
| Reward Name |
String/Array |
Text |
The name of the reward policy (or an array of names) to give. |
| Reward Code |
String/Array |
Text |
Optional. Code for the reward (or array, paired by index with Reward Name). If fewer codes than names are supplied, missing entries are filled with generated UUIDs. |
| Reward Counter |
Number |
Integer |
Number of uses allowed on the issued reward. |
| Check Limit |
Boolean |
true/false |
Optional. Whether to enforce reward-limit checks. Defaults to true. |
| Expiration Date |
Date/Time |
JS Date |
Optional. Expiration date for the reward. Calculated from the policy when omitted. |
JavaScript API
UDF.giveRewardByName(rewardName, rewardCode, rewardCounter, checkLimit, expirationDate, callback)
Events Triggered
Possible Errors
| Error Code |
Error Message |
Description |
| 3001 |
Reward policy with "name" "%s" not found while adding reward to member with unique id "%s" |
Reported if no matching reward policy is found by name. |
| 1611 |
Reward Policy %s is not yet effective |
Reported if the policy's effectiveDate is after the activity date. |
| 1684 |
Reward does not belong to member program |
Reported if the reward isn't defined on the program to which the member belongs. |
| 1680 |
Reward cannot be added for member %s with status %s |
Reported if the member's status isn't in policy.applicableMemberStatus. |
| 2023 |
Reward Policy has already expired on %s |
Reported if the reward policy has expired. |
| 2049 |
No more available redemptions for reward "%s" |
Reported when policy.availableRedemptions <= 0. If checkLimit is false, this error is logged and swallowed for that reward only (other names in the same call continue). |
| 4041 |
Division Access Denied for user |
Reported when user lacks division access for the reward policy. |
Additional Considerations
- Both
Reward Name and Reward Code may be supplied as arrays; rewards are issued in series, one per name. The action returns a flat array of issued rewards.
- When
Reward Code has fewer entries than Reward Name, missing positions are filled with generated UUIDs.
- When
Check Limit is false, only error 2049 (no more redemptions) is suppressed; other validation errors still propagate.