Fluent builder for sending a referral invitation. Obtained from ReferralManager.newReferralBuilder, set the properties for the invitation, then call build to create and send it. Requires at least a recipient email or a target organisation or group before build is called; the sender defaults to the current logged-in profile if fromProfile is not set.
Group: Builders
Methods
canSendEmail(boolean b) · program(ReferralProgram rp) · rewardEntry(RewardEntry rp) · invitedToOrg(Organisation v) · website(Website v) · fromProfile(Profile v) · toEmail(String v) · toName(String v) · invitedToGroup(Group v) · message(String v) · token(String v) · expiryDate(Date v) · build()
canSendEmail(boolean b)
Returns: ReferralBuilder
Whether an invitation email may be sent. Defaults to true. If true, an email is still only sent when automatic email generation is enabled for the application and the referral has a recipient email.
| Parameter | Description |
|---|---|
b | true to allow sending the invitation email |
program(ReferralProgram rp)
Returns: ReferralBuilder
The referral program this invitation belongs to, if any. When set, the invitation's multi-accept flag is copied from the program.
| Parameter | Description |
|---|---|
rp | the referral program the invitation belongs to |
rewardEntry(RewardEntry rp)
Returns: ReferralBuilder
The reward entry to credit to the sender when the invitation is later accepted.
| Parameter | Description |
|---|---|
rp | the sender's reward entry |
invitedToOrg(Organisation v)
Returns: ReferralBuilder
The organisation the recipient will be invited to join.
| Parameter | Description |
|---|---|
v | the organisation to invite the recipient to |
website(Website v)
Returns: ReferralBuilder
The website the invitation is sent from. If not set, the invitation uses the current website context, or falls back to the account's external URL if there is none.
| Parameter | Description |
|---|---|
v | the website to send the invitation from |
fromProfile(Profile v)
Returns: ReferralBuilder
The profile sending the invitation. If not set, defaults to the current logged-in profile.
| Parameter | Description |
|---|---|
v | the sending profile |
toEmail(String v)
Returns: ReferralBuilder
The recipient's email address. Stored lower-cased. Required unless the invitation targets an organisation or group without a specific recipient.
| Parameter | Description |
|---|---|
v | the recipient's email address |
toName(String v)
Returns: ReferralBuilder
The recipient's display name, used when a new profile has to be created for them.
| Parameter | Description |
|---|---|
v | the recipient's name |
invitedToGroup(Group v)
Returns: ReferralBuilder
The group the recipient will be invited to join.
| Parameter | Description |
|---|---|
v | the group to invite the recipient to |
message(String v)
Returns: ReferralBuilder
A personal message from the sender, included in the invitation email if one is sent.
| Parameter | Description |
|---|---|
v | the message text |
token(String v)
Returns: ReferralBuilder
The token to use for the invitation link. If not set, a random UUID is generated when the invitation is built.
| Parameter | Description |
|---|---|
v | the invitation token |
expiryDate(Date v)
Returns: ReferralBuilder
The date after which the invitation and any resulting membership are no longer valid.
| Parameter | Description |
|---|---|
v | the invitation's expiry date |
build()
Returns: Referral
Creates and sends the referral invitation described by this builder. Equivalent to calling ReferralManager.invite with this builder.