WorkflowTask defines a workflow action that creates and assigns a Task record. It controls the assignee, due date, subject, priority, initial status, and assignment email notification. The definition is not the resulting Task record and does not determine when the action runs.
Task action definitions sit in the tasks collection of the object-level Workflow metadata. A WorkflowRule invokes an action by name. Creating or deploying a WorkflowTask alone does not activate automation.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
Required. The task action's local developer name. This is distinct from the object-qualified member name used for selective deployment. |
assignedTo |
The explicit assignee value, interpreted according to assignedToType. User assignments use usernames; role assignments use role names, not record IDs. |
assignedToType |
How Salesforce determines the assignee. Allowed values are accountCreator, accountOwner, accountTeam, creator, opportunityTeam, owner, partnerUser, portalRole, role, and user. |
dueDateOffset |
Required integer. Sets the created task's due date in days relative to offsetFromField, or to the trigger date when that field reference is omitted. Negative values are allowed. |
offsetFromField |
Optional reference to the date field used to calculate the task's due date. It does not schedule action execution. |
notifyAssignee |
Required boolean. Requests an email notification when the task is assigned. |
priority |
Required string. Sets the created Task's priority. WorkflowTask does not declare an enumeration of priority values. |
status |
Required string. Sets the created Task's initial status. WorkflowTask does not declare an enumeration of status values. |
subject |
Required. Supplies the task subject and is used in the assignment email notification when one is sent. |
protected |
Required boolean. When true, components created in the installing organization cannot link to or reference the packaged task action. |
Behavior and Constraints
Invocation belongs to the rule. A WorkflowRule invokes a task through a WorkflowActionReference whose type is Task and whose name identifies the action. References in the rule's actions collection execute when the rule fires. References inside workflowTimeTriggers execute according to the configured time trigger.
The invoking rule supplies active, its evaluation conditions, and triggerType. Its conditions use criteriaItems or formula. These settings belong to WorkflowRule, not WorkflowTask.
Due dates and execution times are separate. A dueDateOffset of -2 places the created task's due date two days before the reference date. It does not make the action execute two days earlier. Delayed execution belongs to WorkflowRule.workflowTimeTriggers, which has its own offsetFromField, timeLength, and workflowTimeTriggerUnit. The time-trigger unit can be Hours or Days; the task's due-date offset is always measured in days.
Assignment depends on the assignment type. Read assignedTo and assignedToType together:
-
userandpartnerUseridentify a user by username inassignedTo. -
roleandportalRoleidentify a Role by role name inassignedTo. -
ownerandcreatorresolve the assignee from the triggering record. -
accountCreatorandaccountOwnerresolve through the related account.accountOwneris documented for Opportunity. -
accountTeamis Account-specific, andopportunityTeamis Opportunity-specific.
Context-based assignment depends on the relevant record and team configuration. The task definition alone does not identify the actual assignee in those cases. Explicit usernames and role names are not interchangeable with record IDs.
Assignment does not imply notification. Configuring an assignee does not by itself request an assignment email. notifyAssignee controls that separately, and subject is used in the notification.
Task creation does not necessarily create open work. The configured status determines the Task's initial state. For example, the documented task definitions use Completed; that example is not a default or a requirement.
Protection applies to metadata references. The protected restriction prevents components created in the installing organization from referencing the packaged action. It is not a setting for access to the Task records that the action creates.
Deployment and Retrieval
In Metadata API package format, workflow definitions use the .workflow suffix and reside in the workflows directory. There is one file per standard or custom object that has workflow, with task definitions stored under tasks. See the Workflow metadata documentation.
Distinguish these two manifest targets:
-
Entire object-level container: use metadata type
Workflowand the object's API name as the member. AWorkflowretrieval with member*retrieves all workflow components. -
Individual task action: community ANT guidance uses metadata type
WorkflowTaskand the member patternObjectApiName.TaskDeveloperName, with a period separator.
The qualified manifest member is not the task's local fullName. The local name must begin with a letter, contain only alphanumeric characters and underscores, contain no spaces or consecutive underscores, and not end with an underscore.
A deployment of an object's Workflow container includes the workflow metadata supplied for that object, not just one task. For selective deployment of a time-based rule, the time trigger travels with WorkflowRule; the referenced task action must also be included separately when it is needed in the target organization.
When moving a task definition between organizations, account for explicit usernames, role names, and any custom date field referenced by offsetFromField. Context-based assignments also depend on the target records and team configuration.
For removal, identify rules and task actions individually rather than targeting the object-level Workflow container for deletion. A Migration Tool report describes rejection of container deletion and recommends individual component targets. That report does not establish that deleting a rule also deletes its task actions.
Relationships
A task action can have consumers beyond a single workflow rule. Rules and other automation structures reference the action by name, while Workflow.tasks contains its definition. A translation reference identifies translatable task content; it does not invoke the action.
References
-
Role:assignedTo, for role-based assignment. -
CustomField:offsetFromField, when the due-date calculation uses a custom date field.
Referenced By
-
ApprovalProcess:name. -
CustomObjectTranslation: nestedname; this is a translation reference, not an action invocation. -
EntitlementProcess:name. -
Workflow:namein action-reference structures. -
WorkflowRule:namein immediate and time-triggered action references.
Explicit usernames are additional name-based assignment dependencies. They identify users in the destination organization rather than metadata components through a record ID.
Reported Issues
-
Selective retrieval and deployment can target the wrong component if the object qualification is missing. A 2017 ANT discussion describes individual workflow members as the object API name, a period, and the component API name. Applied to a task action, the pattern is
ObjectApiName.TaskDeveloperName; the entireWorkflowcontainer instead uses the object API name alone. The discussion also warns that partial workflow deployments can encounter ordering problems when the surrounding workflow is not yet present. ANT retrieval and deployment discussion. -
Deleting the object-level container was rejected. In a 2012 Migration Tool report, a destructive deployment targeting
Workflowfor a custom object failed because rules and actions had to be deleted individually. The answer recommended individual component types and noted that task actions might need separateWorkflowTaskentries. It did not establish cascading deletion from a rule to its task actions. Workflow deletion report. -
A selective time-based deployment can omit the action it needs. A 2021 answer explains that time triggers belong inside
WorkflowRule, while referenced actions, including tasks, must be specified separately for a selective deployment. Deploying the object'sWorkflowcontainer includes the broader workflow metadata for that object. Time-trigger manifest discussion. -
Direct Apex queries were reported as unavailable. A 2021 community inventory listed the same-named Tooling API object
WorkflowTaskas unavailable in Apex'sSchemanamespace and not directly queryable in Apex. Its presence in the Tooling API list therefore did not establish direct Apex query support. Apex query availability discussion.
Common Questions
Does a negative dueDateOffset run a workflow task earlier?
No. It sets the created Task's due date before the reference date. Execution timing belongs to the invoking rule's workflowTimeTriggers, not to WorkflowTask.dueDateOffset.
What member name do I use to deploy one WorkflowTask?
Community ANT guidance uses metadata type WorkflowTask with member ObjectApiName.TaskDeveloperName. The task's local fullName contains only the task developer name. To target the whole container, use Workflow with the object API name.
Does assignedTo accept a Salesforce user ID?
For user and partnerUser, assignedTo identifies the user by username, not record ID. For role and portalRole, it uses a role name. Other assignment types resolve from record or team context.
Why did my workflow create a task that is already completed?
status sets the created Task's initial state. A task action configured with Completed does not create new open work merely because it creates a new record.
Does deploying WorkflowTask activate it or send an assignment email?
Deploying the definition alone does not activate automation. The invoking rule controls activation and evaluation. Assignment email is separate: notifyAssignee controls whether the notification is requested.