JR1035 embed the primary SQL for workflow status