Avatar

Community Advisor

Hi @rohanpat,

this query is realy "hard" and make recompute for each delivery ever sent. Not sure why you use this, as AC will do it  (not in realtime of course).
Tracking tables have link to the delivery table and this is a way to fetch impacted Delivery ID.
One way can be to use Incremental query to fetch all tracking logs since last execution of the workflow. Based on previously mentioned link, use distinct delivery IDs from result and pass it to your JS script (adapt script to read temp query table instead of nms:delivery)
Take care of temporary table behind Incremental query as can grow fast.

Regards,

Milan