Create staff bonus records when appointments are added
When a new appointment is added in Salesforce, a bonus transaction for the staff member is logged automatically, so payroll is ready to process.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/create-staff-bonus-records-when-appointments-are-added/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Human Resources (HR) · Payroll compensation
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/create-staff-bonus-records-when-appointments-are-added
Set it up with the CLI
- Add it. Copies the folder into
zaps/create-staff-bonus-records-when-appointments-are-added/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/create-staff-bonus-records-when-appointments-are-added - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy create-staff-bonus-records-when-appointments-are-added - Check it. Its recent runs, with status and errors.
npx zap-pack logs create-staff-bonus-records-when-appointments-are-added
zaps/create-staff-bonus-records-when-appointments-are-added/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 11 to fill in
- connections/salesforce.tsThe
salesforceaccount it uses - triggers/new-record.tsWhat starts it:
salesforcenew_record1 to fill in - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a new Appointment record is created in Salesforce (
salesforce,new_record). - Bonus tier (code, no step): the appointment's type picks the bonus. Types in
LARGE_TIER_TYPESget $5.00, types inSMALL_TIER_TYPESget $2.50. Any other type stops the run and writes nothing. - Salesforce finds the staff record whose staff match field equals the appointment's staff reference, falling back to the appointment's
OwnerId. If none is found, it creates one. - Salesforce creates a Staff Account Transaction: created date from the appointment, the staff lookup, the bonus amount, the appointment's name as the memo, and the classification labels.
The Zap only creates records. It never changes an existing staff record or transaction.
Ask the user
Each REPLACE_… value is set per person. Resolve names to API names with the user's Salesforce connection; don't ask them to paste a field name you can look up.
| Setting | Where | What goes there |
|---|---|---|
REPLACE_APPOINTMENT_OBJECT |
triggers/new-record.ts, params.object |
The object that holds appointments |
REPLACE_APPOINTMENT_STAFF_REF_FIELD |
config.ts |
The appointment field naming the staff member; falls back to OwnerId |
REPLACE_APPOINTMENT_TYPE_FIELD |
config.ts |
The appointment field holding the type that picks the bonus tier |
REPLACE_STAFF_OBJECT |
config.ts |
The object that holds staff |
REPLACE_STAFF_MATCH_FIELD |
config.ts |
The staff field matched against the appointment's staff reference |
REPLACE_TRANSACTION_OBJECT |
config.ts |
The Staff Account Transaction object |
REPLACE_TX_CREATED_DATE_FIELD |
config.ts |
The transaction field holding the created date |
REPLACE_TX_STAFF_LOOKUP_FIELD |
config.ts |
The transaction field linking to the staff record |
REPLACE_TX_AMOUNT_FIELD |
config.ts |
The transaction field holding the bonus amount |
REPLACE_TX_MEMO_FIELD |
config.ts |
The transaction field holding the memo |
REPLACE_TX_CLASSIFICATION_FIELD |
config.ts |
The transaction field holding the classification label |
REPLACE_TX_DETAIL_FIELD |
config.ts |
The transaction field holding the detail label |
Also review these defaults with them:
SMALL_TIER_TYPESandLARGE_TIER_TYPESinworkflow.ts: which appointment types earn each tier, as exact picklist values. DefaultsStandardandPremium.SMALL_TIER_AMOUNTandLARGE_TIER_AMOUNTinworkflow.ts: the bonus amounts, in the org's currency. Defaults 2.50 and 5.00.TX_CLASSIFICATION_VALUEandTX_DETAIL_VALUEinconfig.ts: the labels written on every transaction. Defaults"Credit"and"Appointment Bonus".
Also ask:
- Does a new staff record need any other required fields? If so, the create step in
workflow.tsmust set them. - Is there a sandbox org to test in? Don't test against a production org.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/create-staff-bonus-records-when-appointments-are-added, replace each REPLACE_… value as this file says, then run npx zap-pack deploy create-staff-bonus-records-when-appointments-are-added, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
salesforceto the user's Salesforce connection for the org that holds appointments, staff and transactions. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/new-record.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connection, and sample the trigger (
new_recordread with the same object) before the first test run. Check that the record carriesId,Name,CreatedDate,OwnerIdand the appointment type and staff fields, then fix any key inworkflow.tsthat doesn't match.
Test it
Run it once as a draft test (run_workflow_draft) against a sandbox org, with field names changed to match the settings:
{
"Id": "a0X000000000001AAA",
"Name": "[install-test] Premium appointment",
"CreatedDate": "2026-10-29T10:00:00.000+0000",
"OwnerId": "005000000000001AAA",
"Type__c": "Premium",
"Staff_Reference__c": "[install-test] STAFF-001"
}
Check in Salesforce that:
- a staff record with reference
[install-test] STAFF-001exists (created on the first run, reused on a second run with the same reference); - one new Staff Account Transaction links to it, with amount 5.00, memo
[install-test] Premium appointment, the created date above and the two classification labels.
Then run it with "Type__c": "Other" and confirm it returns appointment-type-not-eligible and writes nothing. If run-status tools aren't available, check the result in Salesforce directly. Ask the user to delete the test records; the agent doesn't delete them.
Notes
- Tiers are plain code, not a Paths step, so the workflow has only a few Salesforce steps.
- The staff search uses a SOQL
WHEREclause; the reference is quoted and escaped. If more than one staff record matches, the first one is used. - The created date is copied from the appointment as Salesforce sends it. If the transaction's date field is a Date (not Date/Time), Salesforce may reject the full timestamp; trim it to
YYYY-MM-DDor switch the action tocreate_record_utc. - Salesforce holds real records: never test against a production org, and name test records
[install-test] …. - To notify payroll, add a step after the transaction that posts it to Slack, Teams or email. To change the bonus rules, replace the fixed tiers with a percentage of the appointment value or a promotion-based amount.