Skip to content

Give offer by lookup

Give Offer by Lookup FieldΒΆ

Description

The action is used to give an offer to a member using lookup field.

Parameters

Parameter Type Format Description
Lookup Field String Text Field on the offer policy to match against (typically _id or name).
Lookup Value String Text Value to match in the lookup field.
Offer Code String Text Optional. Custom code for the offer. A UUID is generated when omitted.
Offer Counter Number Integer Number of times the offer can be used.
Check Limit Boolean true/false Optional. Whether to enforce limit checks. Defaults to true.
Expiration Date Date/Time JS Date Optional. Expiration date for the offer. Calculated from the policy when omitted.
Future Effective Boolean true/false Optional. When true, allows the offer to be issued even if the policy's effective date is after the activity date.

JavaScript API

UDF.giveOfferByLookup(lookupField, lookupValue, offerCode, offerCounter, checkLimit, expirationDate, futureEffective, callback)

Events Triggered

Possible Errors

Error Code Error Message Description
2015 No offer found / lookup missing Reported when both lookupField and lookupValue are missing or empty.
3001 Reward policy with %s %s not found while adding offer to member with unique id %s. Reported if no matching offer policy is found.
1612 Offer Policy %s is not yet effective Reported if the policy's effectiveDate is after the activity date and Future Effective is false.
1684 Offer does not belong to member program. Reported if the offer isn't defined on the program to which the member belongs.
1680 Offer 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. The reward policy has expired.
2049 No more available redemptions for offer "%s" The offer policy has no remaining redemptions. Suppressed when checkLimit is false.
2062 No more available budget for offer "%s" The offer policy has no remaining budget. Suppressed when checkLimit is false.
4041 Division Access Denied for user Reported when user lacks division access for the reward policy.

Additional Considerations

  • When checkLimit is false, error codes 2049 and 2062 are logged and swallowed (the action returns an empty array). Other validation errors still propagate.
  • After a successful issue, the offer is added to the activity result.