function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Approve Actions not working

I'm trying to do a custom approve method:

List< ProcessInstanceWorkitem > listAprovacoes = [Select Id,ProcessInstanceId, OriginalActorId, CreatedDate, CreatedById,      ActorId  FROM ProcessInstanceWorkitem WHERE ProcessInstance.TargetObjectId =: guia.Id ORDER BY CreatedDate desc limit 1];
ProcessInstanceWorkitem lWorkItem;
lWorkItem = listAprovacoes[0];
Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
req.setComments( parecerTecnico.Justificativa__c );
req.setWorkitemId( lWorkItem.Id );
Approval.ProcessResult result =  Approval.process( req );

After invoke this method the record was approved BUT no one Approve Action was called.

Somebody knows why?

Tks for help.