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
Abderrahmane TRIAAbderrahmane TRIA 

would it be possible to know if the comment of an approval process is empty or not?

would it be possible to know if the comment of an approval process is empty or not? I made this code but I get penultimate comment and no current.
ProcessInstance[] pi = [SELECT Id,TargetObjectid, Status, (SELECT id,actor.name FROM Workitems), (SELECT Id,StepStatus, Comments FROM Steps ORDER BY CreatedDate DESC) FROM ProcessInstance WHERE TargetObjectId =: agr.Id AND Status = 'Pending']; if (pi.size() > 0 ){ system.debug('Comments '+pi[0].Steps[0].Comments); }
AnudeepAnudeep (Salesforce Developers) 
Can you try executing the sample code posted here?
Abderrahmane TRIAAbderrahmane TRIA
Hi Anudeep,

thank you for your answer but with this solution there is always the same problem, my goal is to detect if the comment is empty or not at the time of approved or rejection.

Ctd 
TRIA A