• I re-copied the logic and then pasted it into ssms (query window) and removed some hidden characters and I'm getting below error now.

    EXEC [master].dbo.xp_sqlagent_enum_jobs 1, 'DomainName\lawrence', 'B508F33F-8C69-42B9-9635-4CA66C05548D'

    Msg 241, Level 16, State 1, Line 56

    Conversion failed when converting date and/or time from character string.

    Looks like it's bombing out on the DATEDIFF logic. Thoughts.