Operation Details
Description: Retrieves the details of all activities for the specified user over the specified date range. Also retrieves details of any activities to which the user is invited over the specified date range.
Sterotype: nsmulti
SQL
SELECT
  Activity.activityID,
  Activity.userName,
  Activity.organisationID,
  Activity.subject,
  Activity.activityTypeCode,
  Activity.startDateTime,
  Activity.endDateTime,
  Activity.allDayInd,
  Activity.locationID,
  Activity.locationName,
  Activity.priorityCode,
  Activity.timeStatusCode,
  Activity.notes,
  Activity.recurrenceID,
  Activity.caseID,
  Activity.concernRoleID,
  Activity.slotAllocationID 
INTO
  :activityID,
  :userName,
  :organisationID,
  :subject,
  :activityTypeCode,
  :startDateTime,
  :endDateTime,
  :allDayInd,
  :locationID,
  :locationName,
  :priorityCode,
  :timeStatusCode,
  :notes,
  :recurrenceID,
  :caseID,
  :concernRoleID,
  :slotAllocationID  
FROM
  Activity 
WHERE 
  (
    
    (
      userName = :userName 
      OR organisationID = :organisationID 
    ) 
    OR 
    (
      activityID IN 
      ( 
      SELECT
        activityID 
      FROM
        ActivityAttendee 
      WHERE userName = :userName 
        AND recordStatusCode = :recordStatusCode 
      ) 
    ) 
  ) 
  AND startDateTime <= :endDateTime 
  AND endDateTime >= :startDateTime 
  AND recordStatusCode = :recordStatusCode 
ORDER BY startDateTime