salesforce REQUIRED_FIELD_MISSING on task create - agent's call-logging step missing WhoId
Fixes Salesforce REQUIRED_FIELD_MISSING on Task create when the agent's call-logging step omits WhoId. Use when API task creation fails because the relation to the lead or contact was never set. Not for Event objects, tasks created by flows, or orgs where the required field is something else entirely.
TL;DR
Set WhoId - the Id of the lead or contact the call was with - on every Task the agent creates, and validate required fields client-side before the API call. The task needs to hang off someone; without the relation, Salesforce rejects it.
salesforce REQUIRED_FIELD_MISSING on task create - agent's call-logging step missing WhoIdSteps
- Resolve the lead or contact Id for the call target and include it as WhoId in the task payload, along with Subject and Status. Expected: the create call returns a Task Id instead of REQUIREDFIELDMISSING.
- Validate the payload client-side before sending: WhoId present, Subject non-empty, Status a valid value. Expected: malformed payloads are caught before the API call, not after.
- If the call target is not a person record - for example logging against an Account - use WhatId instead and leave WhoId out. Expected: account-level tasks succeed with WhatId set.
- Write the returned Task Id back to the run record so the call log is traceable. Expected: every logged call has a Task Id stored against it.
Use this when
- the agent's call-logging task create fails with REQUIREDFIELDMISSING
- tasks fail because WhoId was never set
- call logging works for some records but not others
Not for this skill when
- Event objects - they have their own required fields and semantics
- tasks created by flows or process automation - fix those in the flow, not the agent
- a missing required custom field - same pattern, but the field to set is org-specific
Variant phrasings
REQUIREDFIELDMISSING on task create
Same root cause: a required relation field was left empty.
call logging fails over the API
Same fix: include WhoId and pre-validate the payload.
missing WhoId on task
Same fix: resolve the person Id first, then create.
Why it happens
Task is a relational object: depending on org configuration it requires a who (a person: lead or contact), a what (an account, opportunity, or similar), or both. The agent built the task body - subject, notes, call outcome - but never attached it to the person the call was with. Salesforce rejects the orphan task at write time, so every call the agent 'logged' actually vanished.
Edge cases
- Person accounts blur the who/what line - confirm which Id the org expects before standardizing.
- Some orgs require both WhoId and WhatId - check the org's validation rules, not just the API error.
- Shared activities (multiple contacts on one task) need the task relation object, not a single WhoId.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_SQN0D6vGkYtaM2ZGHips8Q