Suppose to have an approval process where the approver of a step is a related user designated through a custom field. If the value of the custom field is changed, all the records in this approval step are unaffected. Of course, in some cases this is the desired behaviour but in some cases it can be not. It is possible to automatically reassign the approvers of these records to the new related users (maybe through a trigger)?

I'm working on something that involves the strategy proposed in this question. However, I've some problems in the SOQL. I need to select from processInstanceWorkItem the records but since the TargetObject of ProcessInstance can be anything, it gives me errors when I try to reference the records fields.

3 Answers 3


If the approval records already submitted for other users then during the change of user in the custom fields better to recall existing approval request and submit a new approval request.

I think for existing approval request changing an user for approval is not possible.

  • I know that it's probably better to simply automatically recall existing approval requests and resend them to approval. However the client doesn't want to dirty the approval history.
    – gvgramazio
    May 27, 2019 at 11:42

I've achieved what I wanted but not in the way I wanted to. I've taken inspiration from the answer to the question already linked in my question.

I took the following steps:

  • Select all the records in ProcessInstanceWorkItem related to the given approval process. The standard object ProcessInstanceWorkItem contains all the info about a pending approval request (like the ActorId, that is the actual approver user id) and the parent record of object ProcessInstance contains the info regarding the whole approval process (like the DeveloperName of the approval process).
  • Select the related user from all the records that has been sent to the approval process. In my case this was possible by simply check the status of the record.
  • Perform the equivalent of an inner join in apex between the values returned by the two queries.
  • Update the ActorId of the the process instance work items.

How did you updated the comments while reassigning the approval request. Could you please suggest.

Fyi,I would be able to update actor using ProcessInstanceWorkItem but not comment.

If you have any alternatives if you suggest that would be great.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .