# SaveClaimNote - Advanced Documentation ## Overview Creates or updates a note on a claim, with support for embedded images and cross-claim note sharing. `ID` 0 creates a new note. `ID` 1 or greater updates that existing note. This is the only way to create or update notes - notes cannot be saved through `SaveClaim`. ## Required Fields - **ParentID** (long) - ClaimID the note belongs to. Must be >= 1. - **Note** (string) - The note text content. - **Type** (LookupInfo) - Note type with valid ID. The note type must belong to the claim's firm. Use the claim's available note types. - **ID** (long) - 0 to create. The existing note's ID to update. ## Optional Fields - **SendToAssociatedClaims** (bool) - Create only. If true, creates a copy of this note on ALL other claims in the same ClaimGroup. Useful for group-wide updates. ## What Gets Set Automatically On Create - **CreatedByID** - Set to the current person - **CreatedDate** - Set to current UTC time - **CreatedByPicture** - Set from the current person's photo - **ImageStorageRoot** - New GUID generated for image storage ## Image Handling Notes support embedded images stored in AWS S3: - Images are uploaded to S3 under the note's `ImageStorageRoot` path - If a new note fails to save after images are uploaded, the images are rolled back (deleted from S3) - Image references in the note text point to the S3 storage location ## Side Effects - Creates or updates the ClaimNote record in the database - If `SendToAssociatedClaims = true` on create: creates notes on all grouped claims - Triggers JSON re-serialization for the claim - Updates last review dates on the claim - Uploads any embedded images to AWS S3 ## Script Example ```javascript async () => { const note = { ID: 0, ParentID: 771360, Note: "Called insurance adjuster. Waiting on response for medical records.", Type: { ID: 1 } }; const created = await SecureApi.SaveClaimNote(note); created.Note = "Adjuster responded. Medical records requested."; const updated = await SecureApi.SaveClaimNote(created); return { id: updated.ID, created: updated.CreatedDate }; } ``` ## Error Conditions - `ParentID < 1` - throws exception - Claim not found - throws exception - Note type not valid for the claim's firm - throws exception - Claim belongs to a different firm - throws exception