Understanding the Salesforce Approval Process: A Step-by-Step Guide
The Approval Process in Salesforce is an automated sequence of steps where a record is reviewed and approved (or rejected) by designated users based on predefined conditions. This ensures compliance, proper authorization, and consistency in business operations.
Key Objects of an Approval Process
1. ProcessNode (Approval Step Definition) (04b)
- Defines the approval steps in a process.
SELECT Id, Name, DeveloperName, ProcessDefinitionId, Description FROM ProcessNode
2. ProcessInstance (Approval Request) (04g)
- Created when a record is submitted for approval.
- Stores the current status and progress of the approval process for that record.
- Acts like a snapshot, tracking where the approval stands at any given moment.
SELECT Id, ProcessDefinitionId, TargetObjectId, Status, CompletedDate, LastActorId FROM ProcessInstance
3. ProcessInstanceHistory
- Keeps a record of all actions (audit trails) taken on a specific approval process instance.
- Logs approvals, rejections, reassignments, and recalls.
- Cannot be queried directly; use the ProcessInstance object and related lists to retrieve history details.
SELECT Id, (SELECT Id, StepStatus, CreatedDate, Comments FROM StepsAndWorkitems) FROM ProcessInstance
4. ProcessInstanceNode (Approval Step Execution Tracker) (0OO)
- Tracks which step an approval request is currently in.
SELECT Id, ProcessInstanceId, ProcessNodeId, NodeStatus, ProcessNodeName FROM ProcessInstanceNode
5. ProcessInstanceWorkItem (Pending Approvals)
- Stores pending approvals and the assigned approvers.
SELECT Id, ProcessInstanceId, OriginalActorId, ActorId, ElapsedTimeInDays, ElapsedTimeInHours, ElapsedTimeInMinutes FROM ProcessInstanceWorkitem
6. ProcessInstanceStep (Approval History)
- Stores information about completed approval steps, including who approved/rejected them and any comments.
- A step within a ProcessInstance and its current status. It provides information about the current state of each approval step within the approval process instance.
SELECT Id, ProcessInstanceId, StepStatus, OriginalActorId, ActorId, Comments, StepNodeId, ElapsedTimeInDays, ElapsedTimeInHours, ElapsedTimeInMinutes FROM ProcessInstanceStep
Keep learning !
Comments
Post a Comment