SAP - Activities - retrieve todays activities

    0

    0

    /* ORDER BY

    DATEPART(hh,OCLG.

    SELECT CONVERT(varchar(10), CAST(OCLG.Recontact AS DATETIME), 105) as 'Date',
    CASE
    WHEN OCLG.Action = 'C' THEN 'Call'
    WHEN OCLG.Action = 'M' THEN 'Meet'
    WHEN OCLG.Action = 'T' THEN 'Task'
    WHEN OCLG.Action = 'E' THEN 'Note'
    WHEN OCLG.Action = 'N' THEN 'Other'
    END as 'Action',
    /*OCLG.CntctTime,*/ OSLP.SlpName as 'Employee', /*OCLT.Name as 'Type',*/ OCRD.CardName as 'Client', OCLG.Details
    
    FROM OCLG
    INNER JOIN OCRD ON OCLG.CardCode = OCRD.CardCode
    INNER JOIN OCLT ON OCLG.CntctType = OCLT.Code
    INNER JOIN OSLP ON OCLG.SlpCode = OSLP.SlpCode
    
    WHERE
    /* activities of today */
    OCLG.Recontact BETWEEN CAST({fn NOW()} AS DATETIME)-1 AND CAST({fn NOW()} AS DATETIME)-0
    OR
    /* older activities, created today */
    (
    OCLG.CntctDate BETWEEN CAST({fn NOW()} AS DATETIME)-1 AND CAST({fn NOW()} AS DATETIME)-0
    AND
    OCLG.Recontact < CAST({fn NOW()} AS DATETIME)-0
    )
    
    ORDER BY
    OCLG.Recontact ASC,
    OSLP.SlpName ASC
    
    
    /*
    AND
    DATEPART(hh,OCLG.CntctDate) > 16
    */
    /*OCLG.Recontact BETWEEN CAST({fn NOW()} AS DATETIME)-6 AND CAST({fn NOW()} AS DATETIME)-5*/
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.