---
title: ClaimNotesService
summary: API reference for ClaimNotesService.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# ClaimNotesService

Implements `IClaimNotesService`, managing the full lifecycle of claim notes (search, retrieve, create, update, delete, print) and computing per-note edit permissions based on age, ownership, supervisor status, and claim security (inmate/secure claims). It is built around `IUnitOfWork` for `ClaimNote`/`ClaimNoteCategory`/`ClaimNoteType` persistence, `IUserProfileService` for the current user and authorization checks, `IDocumentService` for PDF report rendering, `IValidationService` for `NoteEdit` validation, `IRTWService` for return-to-work load codes on external users, `IWorkCalendarService` for computing the edit-eligibility window, and claim/worker query providers plus a Guidewire claim API client used to construct `Claim` domain objects for security checks.

## Purpose
- Determines whether the current user is authorized to update or view notes as an internal ("NCE") user.
- Retrieves notes for a claim filtered by date range, category, and type, applying claim-security masking and per-note `CanEdit`/`CanEditNoteInfo` flags.
- Creates and updates notes, enforcing text length/append rules through `IValidationService`, and using the claim's responsible adjuster as the note author when the claim is inmate or secure.
- Deletes notes only when the requesting note is still within its editable window and the user has permission.
- Produces printable PDF output of a filtered note list.

## Context
- Namespace: `SAIF.Services.Claims.Notes`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| UnitOfWork | `protected readonly IUnitOfWork UnitOfWork` | The unit of work used for all `ClaimNote`, `ClaimNoteCategory`, and `ClaimNoteType` repository access and transactions; exposed as `protected` for subclasses. |
| UserProfileService | `protected readonly IUserProfileService UserProfileService` | Resolves the current application user and their authorization/permission checks. |
| ValidationService | `protected readonly IValidationService ValidationService` | Validates `NoteEdit` instances (via `ClaimNoteValidator`) before create/update operations proceed. |
| DocumentService | `protected readonly IDocumentService DocumentService` | Generates PDF output for printed note lists. |
| RTWService | `protected readonly IRTWService RTWService` | Supplies RTW load codes and access checks used to determine note authorship/masking for external return-to-work users. |
| WorkCalendarService | `protected readonly IWorkCalendarService WorkCalendarService` | Computes the next working day used to bound a note's editable window (`CanEdit`). |
| ClaimNotesService(...) | `public ClaimNotesService(IUnitOfWork unitOfWork, IUserProfileService userProfileService, IDocumentService documentService, IValidationService validationService, IRTWService rtwService, IWorkCalendarService workCalendarService, IWorkerQueryProvider workerQueryProvider, IClaimQueryProvider claimQueryProvider, ICCClaimApiService claimApiService, IClaimDataApiClient gwCaimDataApiClient)` | Validates the unit of work, validation service, user profile service, and work calendar service are non-null, then stores all ten collaborators for use by the instance methods. Also triggers a static AutoMapper configuration step the first time the type is used. |
| IsUpdateUser | `public bool IsUpdateUser()` | Returns true if the current user holds any of the `CTNoteUpdate`, `CTNoteSupervisor`, `RTWAdmin`, `RTWInternalUpdate`, `RTWExternalUpdate`, or `CTNCENotes` permissions. |
| IsNCEUser | `public bool IsNCEUser()` | Returns true if the current user holds the `CTNCENotes` permission. |
| GetNotes | `public IEnumerable<Note> GetNotes(ClaimNoteSearchCriteria criteria)` | Returns notes for the claim matching the optional from/thru date, category, and type filters, each populated with `CanEdit`/`CanEditNoteInfo` flags computed against the current user's role and the claim's inmate/secure status. |
| GetNote | `public Note GetNote(long noteId)` | Returns a single note mapped to its contract with `CanEdit`/`CanEditNoteInfo` computed, or a mapped null result if the note does not exist. |
| SaveNote | `public bool SaveNote(long noteId, NoteEdit noteEdit, IMessageContainer messageContainer)` | Validates the edit, then — if valid — begins a transaction, fails with a concurrency error if the stored `UpdateDate` differs from the edit's expected value, otherwise applies category/type/text changes (appending text when `AppendText` is supplied), attributes the update to the responsible adjuster for inmate/secure claims or an RTW-suffixed/plain user ID otherwise, and commits; returns whether the edit was valid. |
| DeleteNote | `public bool DeleteNote(long noteId, IMessageContainer messageContainer)` | Returns false if the note does not exist; adds a permission error and returns false if the note's computed `CanEdit` is false; otherwise deletes the note within its own transaction and returns true. |
| GetCategories | `public IEnumerable<NoteCategory> GetCategories()` | Returns all claim note categories ordered by description. |
| GetTypes | `public IEnumerable<NoteType> GetTypes()` | Returns all claim note types ordered by description. |
| CreateNote | `public Note CreateNote(long claimId, NoteEdit noteEdit, IMessageContainer messageContainer)` | Validates the edit, then — if valid — builds a new `ClaimNote` (category, type, text, dates), attributes authorship to the responsible adjuster for inmate/secure claims and appends an RTW load-code suffix for authorized external users, persists it in its own transaction, and returns the newly created note as loaded via `GetNote`; returns an empty `Note` if validation fails. |
| PrintNotes | `public byte[] PrintNotes(ClaimNoteSearchCriteria filter)` | Builds an XML report payload for the filtered note list, sorted per `filter.Sort` if supplied, and returns rendered PDF bytes from `IDocumentService.GeneratePdf` using the `"Claims_TaskAndNotes_ClaimNotes"` template. |

## Behavioral notes
- A note's `CanEdit` flag requires it be created within the last 6 days and still within two work days (via `IWorkCalendarService.NextWorkDay`) of its create date, combined with being a supervisor, the original creator, or having secure-claim access.
- Notes on inmate or secure claims are authored/updated under the claim's `ResponsibleAdjuster.MailId` rather than the acting user's own ID.
- External users with an RTW load code and `RTWExternalUpdate` authorization have their user ID suffixed with `-{RTWLoadCode}` on create/update, distinguishing RTW-originated edits.
- `SaveNote` treats a stale `UpdateDate` as an optimistic-concurrency conflict, rolling back and reporting a "record has been updated by someone else" error.
- A static constructor runs `CreateMappings()` once per process to configure the AutoMapper maps this service relies on*.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- Services/SAIF.Services/Claims/Notes/ClaimNotesService.cs
