You need to sign in to do that
Don't have an account?
Santosh Reddy 10044
Trying to recall all the records which were submitted between 3 months But my logic is only working for 1 record ., im trying to bulkify, which is throwing me an error
list<ProcessInstanceWorkitem> workItems = [SELECT Id,ProcessInstance.TargetObjectId,actorid,createddate,CreatedById
FROM ProcessInstanceWorkitem WHERE actorId = '00537000000GePo' and
ProcessInstance.Status = 'Pending' and
(createddate> 2018-01-01T01:00:00Z and createddate< 2018-04-30T01:00:00Z) ];
system.debug('what is this'+workItems.size());
list<Approval.ProcessWorkitemRequest> y = new list<Approval.ProcessWorkitemRequest>();
Set<Id>tId = new Set<Id>();
for(ProcessInstanceWorkitem ccc : workItems){
tId.add(ccc.id);
}
list<Id> sdcc = new list<Id>();
for(Id ff : tId){
sdcc.add(ff);
}
for(integer i = 0; i< sdcc.size(); i++){
Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest();
pwr.setAction('Removed');
pwr.setWorkItemId(sdcc[i]);
pwr.setNextApproverIds(new Id[] {'00537000000GePo'});
Approval.process(pwr);
}
FROM ProcessInstanceWorkitem WHERE actorId = '00537000000GePo' and
ProcessInstance.Status = 'Pending' and
(createddate> 2018-01-01T01:00:00Z and createddate< 2018-04-30T01:00:00Z) ];
system.debug('what is this'+workItems.size());
list<Approval.ProcessWorkitemRequest> y = new list<Approval.ProcessWorkitemRequest>();
Set<Id>tId = new Set<Id>();
for(ProcessInstanceWorkitem ccc : workItems){
tId.add(ccc.id);
}
list<Id> sdcc = new list<Id>();
for(Id ff : tId){
sdcc.add(ff);
}
for(integer i = 0; i< sdcc.size(); i++){
Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest();
pwr.setAction('Removed');
pwr.setWorkItemId(sdcc[i]);
pwr.setNextApproverIds(new Id[] {'00537000000GePo'});
Approval.process(pwr);
}
Do you want to delete for one time or you need into the code
Why can't you use the Mass Transfer Approval Requests ??