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
AK_SmithAK_Smith 

Compare results of 2 SOQL requests

Hello!
I have 2 objects PA__c and journal__c

I need to create a new record on object stat__c and write results to the fields.

stat__c .Field1__c. If there any journal__c created within 30 min after first PA__c (datetime field Start_date__c) than Field1__c = yes
stat__c .Field2__c. If there any journal__c created within 8 hours  after last PA__c (datetime field Start_date__c) than Field2__c = yes

The trigger should be schedulable