• Thomas Schmidt 11
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
Hi, i built a dynamic approvalprocess with FlowOrchestrator. I would like to display the oben FlowOrchestratonWorkItems in a RelatedList on the RelatedRecord. As "FlowOrchestrationWorkItem" is not offered as related List i tried different appexchange-tools (EnhancedRelatedList for example) and also they couldn´t use the ObjectsAPI "FlowOrchestrationWorkItem".
Finally i wanted to built a LWC and i am not getting my recors querried. When querrieyng in Apex Anonymous it works

"FlowOrchestrationWorkItem item = [  SELECT Name, Label, Status, RelatedRecordId, AssigneeId
    FROM FlowOrchestrationWorkItem
    LIMIT 1 ];
system.debug(item);"

but as soon as i want to use it in a class i can´t deploy the class to my org "Invalid type"
User-added image
 Can someone help me and tell me what i am doing wrong?

best regards,
Thomas
Hi, 
i built a quite big flow and missed to build it as a scheduled flow.
As i don´t want to rebuild it i just used a scheduled ApexClass to trigger the flow.

As i am really new to apex i have a hard time figuring out how to make a testingclass for that case. This is my class that invokes the flow:
 
global class AbsenceRenewal  implements Schedulable{
    
    global void execute(SchedulableContext sc){ 
        if(Date.Today().month()==12){
            AbsenceRenewal();
        }  
    }
   
    private void AbsenceRenewal() {   
        Map<String, Object> params = new Map<String, Object>();
        Flow.Interview.Create_Absences_for_next_Year ABflow = new Flow.Interview.Create_Absences_for_next_Year(params);
        ABflow.start();
    }
    
}

and of what i found from the internet i came this far with my testclass:
 
@isTest
private class AbsenceRenewalScheduledTest{
     
    static testmethod void schedulerTest(){
         
        String cronexpression = '0 0 0 15 3 ? *';
        
        
         
        Test.startTest();
        
        AbsenceRenewal.AbsenceRenewal();
        String jobId = System.schedule('AbsenceRenewal',  cronexpression, new AbsenceRenewal());
        CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId];
        System.assertEquals(cronexpression, ct.CronExpression);
        System.assertEquals(0, ct.TimesTriggered);
        
        
        Test.stopTest();
    }
}

that way i get 28% code coverage but actually really only the Schedulable interface is tested. How can i test the flowexecution?

Best regards,
Thomas
Hi, 
i have a Time-Tracking app in salesforce where users track their work in percent of their time per workday. i want to autocalculate the overhead ( 100 - actually tracked work form multiple records) every morning in a batch job.
Therefore i think it would be needed that all TimeTracking-records with the same employee and day have to be included in the same batch to compare everything and calculate the overhead. is There an option to make sure that, if for example 5 TimeTrackingrecords with the same employeee-entry and the same date exist, dont get spread over two batches?

best regards,
Thomas