You need to sign in to do that
Don't have an account?
rfg
Generate a debug log for an Apex class that runs when a report is exported
I'm trying to create an Apex Condition on a Transaction Security Policy. The code runs when a user attempts to export a report. The code I'm trying to modify looks like this:
global class BlockLargeDataExportEventCondition implements TxnSecurity.EventCondition { public boolean evaluate(SObject event) { switch on event{ when ReportEvent reportEvent { return evaluate(reportEvent); } when null { // Don't take policy action when event is null return false; } when else{ // Don't take policy action when event is not handled return false; } } } /** * Handle evaluating ReportEvent */ private boolean evaluate(ReportEvent reportEvent){ Profile profile = [SELECT Name FROM Profile WHERE Id IN (SELECT profileId FROM User WHERE Id = :reportEvent.UserId)]; // Take policy action only if the user profile is not 'System Administrator' and // RowsProcessed greater than 250. if (!profile.Name.contains('System Administrator') && ReportEvent.Operation.equals ('ReportExported') && reportEvent.RowsProcessed > 250) { return true; } return false; } }But I can't seem to get any debug logs generated, so when I try to `System.debug` my variables (I'm trying to modify this to check for a specific permission set instead of a Profile), I can't see why it's not working. I'm trying to activate a debug log for my User. I get logs for other things my user account does (like edit the Apex class), but no logs are generated when I export a report. Any idea what I'm doing wrong?
Thanks,
All Answers
Thanks,