Scripting Contexts
Every scripting hook in DonorPoint runs with a specific set of variables in context. This page is the authoritative reference for what is available in each context. All Scripting sub-topics throughout the documentation link here.
Form Pre-Processing Context
Hook: Pre-Processing Script on a Campaign
When: The form page loads
| Variable | Contents |
|---|---|
campaign |
The Campaign (form) being rendered |
account |
The DonorPoint account |
user |
The logged-in UserAccount (if any) |
contact |
The logged-in Contact (if any) |
request |
URL parameters passed to the form |
Form Post-Processing Context
Hook: Post-Processing Script on a Campaign
When: A transaction is successfully saved
| Variable | Contents |
|---|---|
campaign |
The Campaign (form) |
purchaseOrder |
The completed Transaction |
contact |
The donor’s Contact record |
organization |
The linked Organization (if any) |
account |
The DonorPoint account |
orderItems |
All Order Items in the transaction |
payment |
The Payment record |
Item Pre-Processing Context
Hook: Pre-Processing Script on an Item
When: The donor selects this item on the form
| Variable | Contents |
|---|---|
orderItem |
The new Order Item being created |
purchaseOrder |
The in-progress Transaction |
contact |
The donor’s Contact record |
account |
The DonorPoint account |
campaign |
The Campaign (form) |
Item Validation Context
Hook: Validation Script on an Item
When: The donor submits the form (before saving)
Same variables as Item Pre-Processing. Return a non-empty string to block submission — that string is shown as the error message.
Item Post-Processing Context
Hook: Post-Processing Script on an Item
When: The Order Item and Transaction are successfully saved
| Variable | Contents |
|---|---|
orderItem |
The saved Order Item |
purchaseOrder |
The complete Transaction |
contact |
The donor’s Contact record |
account |
The DonorPoint account |
campaign |
The Campaign (form) |
Event Handler Context
Hook: Event Handlers
When: A record lifecycle event fires (create, load, insert, update)
| Event Name Pattern | When |
|---|---|
onCreate{EntityName} |
Record created in memory, before first save |
postLoad{EntityName} |
Record loaded from database |
postInsert{EntityName} |
Record first saved to database |
postUpdate{EntityName} |
Existing record updated |
| Variable | Contents |
|---|---|
instance |
The entity record (Contact, Organization, Transaction, etc.) |
account |
The DonorPoint account |
user |
The staff member performing the action (if applicable) |
Entity name mapping (use system names in event handler names):
| Display Name | System Name | Example Event |
|---|---|---|
| Contact | Contact | postInsertContact |
| Organization | Organization | postUpdateOrganization |
| Transaction | PurchaseOrder | postInsertPurchaseOrder |
| Volunteer Record | VolunteerInstance | postInsertVolunteerInstance |
| Recurring Donation | RecurringDonationInstance | postUpdateRecurringDonationInstance |
| Fund | Fund | postInsertFund |
Email Generation Context
Hook: Scripts in Email Definitions
When: An Email Instance is generated from an Email Definition — once per recipient
Scripts run per email instance, not per transaction. A mass email to 5,000 contacts runs the script 5,000 times.
Receipt Email (Transaction Autoresponder)
| Variable | Contents |
|---|---|
contact |
The recipient’s Contact record |
account |
The DonorPoint account |
campaign |
The form this transaction came from |
purchaseOrder |
The transaction being receipted |
orderItems |
All line items in the transaction |
Mass Email (Email Solicitation)
| Variable | Contents |
|---|---|
contact |
The individual recipient’s Contact record |
account |
The DonorPoint account |
emailSolicitation |
The mass email job |
emailDefinition |
The email template being rendered |
Recurring Payment Email
| Variable | Contents |
|---|---|
contact |
The donor’s Contact record |
account |
The DonorPoint account |
recurringDonationInstance |
The recurring donation schedule |
purchaseOrder |
The most recent payment transaction |
Scheduled Script Context
Hook: Scheduled Scripts
When: The configured schedule fires (nightly, weekly, monthly, etc.)
| Variable | Contents |
|---|---|
account |
The DonorPoint account |
user |
The configured run-as UserAccount |
schedule |
The ScheduledModule record |
Payout Calculation Context
Hook: Payout Calculation Scripts
When: During the Build Payouts action on a Payout Batch
| Variable | Contents |
|---|---|
payoutBatch |
The Payout Batch being calculated |
fund |
The Fund being evaluated |
organization |
The agency Organization |
account |
The DonorPoint account |
campaignYear |
The campaign year in scope |