• Thomas Schmidt 11
  • 0 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
  • 0
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 ];

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,
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){ 
    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);

and of what i found from the internet i came this far with my testclass:
private class AbsenceRenewalScheduledTest{
    static testmethod void schedulerTest(){
        String cronexpression = '0 0 0 15 3 ? *';
        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);

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

Best regards,
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,