Today I was creating some alert rules and needed to make some modifications to the alerting functionality. Something didn’t go quite as expected, so I wanted to debug the execution of an alert action.
Here is how you can do it :
- Make sure the debug mode is set to ‘when breakpoint’ for the user linked to the alert
- Put a breakpoint in the EventJobCud class, method Run
- Change the EventJobCus class, method Run so that it does not use the runAs command :
( Revert these changes when the debugging is done, but for now you need to make this change otherwise you will not be able to step into the EventAction classes for debugging)
void run()
{
EventCUD event;
container params;
RunAsPermission runAsPermission;
;
this.expandCudRecords();
while select event
group by UserId
where (event.Status == BatchStatus::Waiting) &&
(event.CompanyId == curext())
{
params = connull();
runAsPermission = new RunAsPermission(event.UserId);
runAsPermission.assert();
//BP Deviation Documented
//runas(event.UserId, classnum(EventJobCUD), staticmethodstr(EventJobCUD, runCudEventsForUser),params,
// curext(), EventJobCUD::getLanguageId(event.UserId));
EventJobCUD::runCudEventsForUser(params);
CodeAccessPermission::revertAssert();
}
this.cleanupExecuting();
}