You need to sign in to do that
Don't have an account?
chandu kari 8
hii, i am getting problem,i want to display approval history details in data table using LWC
public with sharing class Approvalhistory {
@AuraEnabled(cacheable=true)
public static list<ProcessInstanceHistory> getApprovalData(string recordId) {
list<ProcessInstanceHistory>history=new list<ProcessInstanceHistory>();
for(ProcessInstance processInstance: getAllhistory(recordId).values())
{
for(ProcessInstanceHistory sWI:processInstance.StepsAndWorkitems)
{
system.debug('stepStatus :: '+sWI.StepStatus);
system.debug('stepName :: '+sWI.Actor.Name);
history.add(sWI);
}
}
return history;
}
@AuraEnabled
public static Map<Id,ProcessInstance> getAllhistory(Id recordId) {
return new Map<Id,ProcessInstance>([SELECT Id,Status,SubmittedById,
(SELECT Id, ProcessNodeId,StepStatus, Comments, TargetObjectId,ActorId,CreatedById,IsDeleted,
IsPending,OriginalActorId,ProcessInstanceId,RemindersSent,CreatedDate, Actor.Name,
OriginalActor.Name , ProcessNode.Name
FROM StepsAndWorkitems ORDER BY CreatedDate DESC )
FROM ProcessInstance
WHERE TargetObjectId =: recordId ORDER BY CreatedDate DESC ]);
}
This is my code ,
please help me
@AuraEnabled(cacheable=true)
public static list<ProcessInstanceHistory> getApprovalData(string recordId) {
list<ProcessInstanceHistory>history=new list<ProcessInstanceHistory>();
for(ProcessInstance processInstance: getAllhistory(recordId).values())
{
for(ProcessInstanceHistory sWI:processInstance.StepsAndWorkitems)
{
system.debug('stepStatus :: '+sWI.StepStatus);
system.debug('stepName :: '+sWI.Actor.Name);
history.add(sWI);
}
}
return history;
}
@AuraEnabled
public static Map<Id,ProcessInstance> getAllhistory(Id recordId) {
return new Map<Id,ProcessInstance>([SELECT Id,Status,SubmittedById,
(SELECT Id, ProcessNodeId,StepStatus, Comments, TargetObjectId,ActorId,CreatedById,IsDeleted,
IsPending,OriginalActorId,ProcessInstanceId,RemindersSent,CreatedDate, Actor.Name,
OriginalActor.Name , ProcessNode.Name
FROM StepsAndWorkitems ORDER BY CreatedDate DESC )
FROM ProcessInstance
WHERE TargetObjectId =: recordId ORDER BY CreatedDate DESC ]);
}
This is my code ,
please help me