Posts

Showing posts with the label Approval Process

Salesforce Fact #711 | Autolaunched flow from approval process

In order to launch an auto-launched flow from field update of approval process, the flow API Version needs to be v54.0 or higher. Reference:  https://salesforce.stackexchange.com/questions/328871/flow-builder-not-firing-up-after-approval-process

Salesforce Fact #630 | LockType in ProcessDefinition

ProcessDefinition object stores the details of the approval processes in the org. It has a field named LockType. Each record in approval is always locked. Now based on the editability of the locked record, a locked record can only be edited by admin and by the current approvers. If the locked record can only be edited by Admin, the value of this field is 'Admin' & if the record is editable by Admin and the current approvers, the value of this field is 'WorkItem'. Reference:  https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_processdefinition.htm

Salesforce Fact #5 | recall

Most of the times we approve or reject a record submitted for approval using apex. But we can also recall a record using apex as below: ProcessInstanceWorkItem pwr = [SELECT Id FROM ProcessInstanceWorkItem WHERE ProcessInstance.TargetObjectId=<recordId>]; Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest(); req.setWorkItemId(pwr.Id); req.setAction('Removed'); Approval.process(req);