We tried that also - no luck. We have even copied the SysIDs directly from the printed output of the script when run as a background script and it worked. It is only when the javascript reference is in the filter condition that it fails. It fails even though the entity filter claims to have found records.