External identifier resolution (auditor, MCO, RTW, group, policy, injured worker)¶
mdlCustomerContact exposes six resolution functions that map an external source-system identifier to a local clsCustomer, creating the customer and a CUSTOMER_SOURCE/type-specific mapping row on first use. All six follow the same lookup-or-create shape, differing only in the source reference table(s) they read and the CustomerTypeCode they assign, so they are documented together as one operation.
| Field | Value |
|---|---|
| Operation ID | OP-CC-10 |
| Trigger | GetCustomerIDForAuditor, GetCustomerIDForMCO, GetCustomerIDForRTW, GetCustomerIDForGroup, GetCustomerIDForPolicy, or GetCustomerIDForInjuredWorker |
| Inputs | An external source-system identifier appropriate to the type (auditor ID, MCO source ID, RTW source ID, group ID, policy ID, or worker ID) |
| Outputs | Resolved CustomerID (or a populated WorkerInfo for the injured-worker path); newly created COMPANY row and mapping row when no mapping existed |
| Primary components | mdlCustomerContact.GetCustomerIDForAuditor, GetCustomerIDForMCO, GetCustomerIDForRTW, GetCustomerIDForGroup, GetCustomerIDForPolicy, GetCustomerIDForInjuredWorker |
| Entry point | Business\SAIF.Business.CustomerContact\mdlCustomerContact.vb |
Steps¶
- Auditor resolution (
GetCustomerIDForAuditor). - Read
PA_AUDITORfor the source auditor record (SQL-051, PA_AUDITOR). - Look up an existing
CUSTOMER_AUDITORmapping (SQL-050, CUSTOMER_AUDITOR). - If none exists: create a
clsCustomerwithCustomerTypeCode = "AUDIT", save it, then insert the mapping row (SQL-020). - On a mapping-insert failure: roll back by deleting the newly created customer.
- MCO resolution (
GetCustomerIDForMCO). - Look up an existing mapping by reading
CUSTOMER_SOURCEdirectly, filtered to the MCO source type (one of SQL-054/SQL-055/SQL-056/SQL-062 depending on the specific source-type filter, all against CUSTOMER_SOURCE). - Unlike the other five resolution functions,
GetCustomerIDForMCOperforms no customer creation — if noCUSTOMER_SOURCErow is found, it returns without creating a new customer.* - RTW resolution (
GetCustomerIDForRTW). - Read
CUSTOMER_SOURCEandRTW_LOAD_CODEfor the source RTW record (SQL-061, RTW_LOAD_CODE). - If no mapping exists: create a
clsCustomerwithCustomerTypeCode = "RTW", save it, then insert aCUSTOMER_SOURCEmapping row. - Group resolution (
GetCustomerIDForGroup). - Look up an existing mapping in
CUSTOMER_GROUP(SQL-053, CUSTOMER_GROUP); if not found, fall back toCUSTOMER_SOURCE, then readGROUP_ASSOCIATIONfor the source record (SQL-052, GROUP_ASSOCIATION). - If none exists: create a
clsCustomerwithCustomerTypeCodeset to"GROUP"or"LOSSC"depending on theGroupTypesvalue of the source record, save it, then insert theCUSTOMER_GROUPmapping row (SQL-021). - Unused-variable oddity: a second
Sqlobject (sql2) is declared for this flow but never executed — the code instead reusesSql.Executefor the relevant statement, leavingsql2dead in the current source.* - Policy resolution (
GetCustomerIDForPolicy). - Look up an existing mapping in
CUSTOMER_POLICY(SQL-057, CUSTOMER_POLICY). - If none exists: read
POLICYfor the source record (SQL-058, POLICY), create aclsCustomerwithCustomerTypeCode = "POL", save it, then insert theCUSTOMER_POLICYmapping row (SQL-023). - Injured-worker resolution (
GetCustomerIDForInjuredWorker). - Read
CUSTOMER_SOURCEfor an existing mapping. - If none exists, call the external
CCClaimDataApiAPI client (inDPI.ApiClients.Item("CCClaimDataApi")) via routev1/ExternalLogin/PersonDetails/{workerID}to retrieve the worker's identity details from the external claims data service. This is an external API integration outside the SAIF library dependency graph, not an in-repo project/package reference. - Create or update a
clsCustomerwithCustomerTypeCode = "WORK"andIsPerson = True; insert aCUSTOMER_SOURCEmapping row if the customer is new. - The returned
WorkerInfoobject only hasCustID,PersonID, andWorkerIDpopulated — other fields present in the external API response are read during resolution but are not copied ontoWorkerInfoor otherwise persisted.*
Process flow¶
The following diagram visualizes the shared lookup-or-create shape across all six identifier types.
flowchart TD
Start([GetCustomerIDFor* called]) --> Type{Identifier type}
Type -->|Auditor| AuditorLookup[Read PA_AUDITOR;<br>lookup CUSTOMER_AUDITOR]
Type -->|MCO| MCOLookup[Lookup CUSTOMER_SOURCE only]
Type -->|RTW| RTWLookup[Read CUSTOMER_SOURCE + RTW_LOAD_CODE]
Type -->|Group| GroupLookup[Lookup CUSTOMER_GROUP,<br>fallback CUSTOMER_SOURCE;<br>read GROUP_ASSOCIATION]
Type -->|Policy| PolicyLookup[Lookup CUSTOMER_POLICY;<br>read POLICY]
Type -->|Injured worker| WorkerLookup[Lookup CUSTOMER_SOURCE]
AuditorLookup --> Found1{Mapping found?}
RTWLookup --> Found2{Mapping found?}
GroupLookup --> Found3{Mapping found?}
PolicyLookup --> Found4{Mapping found?}
WorkerLookup --> Found5{Mapping found?}
MCOLookup --> Found6{Mapping found?}
Found6 -->|No| ReturnEmpty([Return without creating])
Found6 -->|Yes| ReturnID([Return existing CustomerID])
Found1 -->|Yes| ReturnID
Found2 -->|Yes| ReturnID
Found3 -->|Yes| ReturnID
Found4 -->|Yes| ReturnID
Found5 -->|Yes| ReturnWorker([Return WorkerInfo])
Found1 -->|No| CallApi1[Create customer;<br>save; insert mapping]
Found2 -->|No| CallApi2[Create customer;<br>save; insert mapping]
Found3 -->|No| CallApi3[Create customer;<br>save; insert mapping]
Found4 -->|No| CallApi4[Create customer;<br>save; insert mapping]
Found5 -->|No| CallExternalApi[Call CCClaimDataApi<br>PersonDetails endpoint]
CallExternalApi --> CreateWorker[Create/update customer;<br>insert mapping if new]
CreateWorker --> ReturnWorker
CallApi1 --> ReturnID
CallApi2 --> ReturnID
CallApi3 --> ReturnID
CallApi4 --> ReturnID
Failure and edge-case behavior¶
GetCustomerIDForMCOis the only one of the six functions that never creates a customer; if theCUSTOMER_SOURCElookup misses, the caller receives no customer and must handle that outcome itself.*GetCustomerIDForGroupdeclares an apparently-unusedSqlobject (sql2) alongside the one actually executed, suggesting either dead code or an incomplete refactor; behavior is unaffected since the executed statement covers the mapping insert.*GetCustomerIDForInjuredWorkerdepends on an external API call (CCClaimDataApi) rather than another SAIF library, so its availability and correctness depend on that external service; onlyCustID,PersonID, andWorkerIDfrom the response are retained on the returnedWorkerInfo, with the remaining response fields discarded after use.*
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Related documentation¶
Sources¶
Business\SAIF.Business.CustomerContact\mdlCustomerContact.vbBusiness\SAIF.Business.CustomerContact\WorkerInfo.vb