ProcessInstance

Represents an instance of a single, end-to-end approval process. Use this and the node, step, and workitem process instance objects to create approval history reports.
Note
Exceptions apply to approval history data retrieved with this object and available only via the SOAP API. For each approval process instance that was pending when Summer ’14 became available for your organization, some field values are never populated or are populated only after the approval process instance is next acted upon—such as when a user approves, rejects, or reassigns an approval request—after the Summer ’14 rollout.

For approval process instances that were completed before the Summer ’14 rollout, all Process Instance fields are automatically populated, with one exception: CompletedDate is never populated for approval process instances that were completed before January 1, 2013. For approval process instances that were pending during the Summer ’14 rollout, all ProcessInstance fields are automatically populated, with two exceptions: CompletedDate and LastActorId are populated only after the approval process instance is complete.

Supported Calls

describeSObjects(), query(), retrieve()

Special Access Rules

Portal and Communities users can’t access this object.

Fields

Field Details
CompletedDate
Type
dateTime
Properties
Filter, Sort
Description
The completion date and time of the approval process. The ElapsedTimeDay, ElapsedTimeHours, and ElapsedTimeMinutes field values are calculated using CompletedDate.
ElapsedTimeInDays
Type
double
Properties
Filter, Sort
Description
The total elapsed time in days between when the approval process instance was started and now.
ElapsedTimeInHours
Type
double
Properties
Filter, Sort
Description
The total elapsed time in hours between when the approval process instance was started and now.
ElapsedTimeInMinutes
Type
double
Properties
Filter, Sort
Description
The total elapsed time in minutes between when the approval process instance was started and now.
LastActorId
Type
reference
Properties
Group, Filter, Sort
Description
The last actor that approved, rejected, or recalled the process.
ProcessDefinitionId
Type
reference
Properties
Defaulted on create, Group, Filter, Sort
Description
The ID of this approval process instance.
Status
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
The status of this approval process instance, for example Started, Pending, or Approved.
TargetObjectId
Type
reference
Properties
Filter, Group, Sort
Description
ID of the object affected by this approval process instance.

Usage

Use this object to query or retrieve an approval process.

The following SOQL query returns details for all the ProcessInstanceStep records related to individual ProcessInstance records. The nested query references Steps, which is the child relationshipName for ProcessInstanceStep in the ProcessInstance object.

SELECT Id, (SELECT Id, StepStatus, Comments FROM Steps)
FROM ProcessInstance

The following SOQL query returns details for all the ProcessInstanceWorkitem records related to individual ProcessInstance records. The nested query references Workitems, which is the child relationshipName for ProcessInstanceWorkitem in the ProcessInstance object.

SELECT Id, (SELECT Id, ActorId, ProcessInstanceId FROM Workitems)
FROM ProcessInstance

ProcessInstanceHistory can help provide a unified read-only view of the ProcessInstanceStep and ProcessInstanceWorkitem objects.

© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.