[SalesForce] Reassign approval request in Apex

I have a scenario where I want to 'reassign' the approval request to a certain user if a certain condition is fulfilled.

Also during the reassignment I want to update Comments that would be readable in the Approval History section on the page layouts.

I want to achieve this specifically through Apex.

I have looked at ProcessSteps object that gives me the Comments field, but that is locked for updation.

Can someone please guide me in the right direction?

Best Answer

You can redirect the approval step using the ActorId property of ProcessInstanceWorkItem object. Unfortunately as you said, comments are readonly and according to this thread it's not going to change soon.

There only workaround I can imagine would be to create custom history list and manage it by your own.

Related Topic