# SaveClaimContact - Advanced Documentation ## Overview Creates or updates a contact association on a claim, including the contact's role (e.g., adjuster, attorney, witness) and ad hoc fields. This links an existing contact record to a claim - it does not create new contacts. Use `SaveContactPerson(person)` or `SaveContactCompany(company)` to create the contact first - both take a BaboContactInfo and return the saved contact, whose `.ID` is what you pass here. ## Create vs Update - **New association**: Set `ID = -1` to create a new claim contact - **Update existing**: Set `ID` to the existing ClaimContactInfo ID ## Ad Hoc Fields Claim contacts can have their own ad hoc fields (e.g., policy number, claim number for an insurance adjuster). The same DataType rules from `SaveClaim` apply: | DataType | Property to Set | |----------|----------------| | Number | `NumberValue` | | Decimal | `DecimalValue` | | TextShort | `TextShortValue` | | TextLong | `TextLongValue` | | Date | `DateValue` | | DateTime | `DateTimeValue` | | Yes/No | `YesNoValue` | | Dropdown | `DropdownValue` | | Staff | `Staff` | | Contact | `BaboContact` | **Critical: `FieldValue` is read-only.** Set the specific typed property matching the field's DataType. All staff referenced in ad hoc fields must be current or former members of the firm. ## Sync Token If `IsSynced = true` and `SyncToken` is null, a new SyncToken is generated automatically. This supports external calendar/email sync integrations. ## Side Effects - Creates or updates ClaimContact entity - Syncs ad hoc fields via SubType sync (records not in input are removed - send the complete set) - Updates claim Timestamp - Triggers JSON re-serialization for the claim ## Script Example ```javascript async () => { const claimContact = { ID: -1, Claim: { ID: 771360 }, Contact: { ID: 5001 }, ContactType: { ID: 3 }, AdHocFields: [ { AdHocFieldDefinitionID: 101, TextShortValue: "POL-2025-001" }, { AdHocFieldDefinitionID: 102, TextShortValue: "CLM-789" } ] }; const result = await SecureApi.SaveClaimContact(claimContact); return { id: result.ID, contact: result.Contact?.Name }; } ``` ## Error Conditions - Staff members in ad hoc fields not part of firm - throws exception - Save failure - throws RadoloException with details