Underwriter Functions¶
Functions for automated underwriting decisions, referrals, and risk assessment.
Overview¶
The Underwriter subsystem manages:
- Automated decisions - Accept, decline, or refer quotes
- Multi-level referrals - Route to appropriate authority levels
- Endorsements - Add policy conditions and exclusions
- Decision tracking - Maintain audit trail of underwriting decisions
Decision Functions¶
$AddUnderwriterDecision¶
Records an underwriting decision.
Signature
$AddUnderwriterDecision(decision, code, message, authorityLevel)
// OR
$AddUnderwriterDecision(decisionObject)
Parameters
decision(string) - Decision type: "Valid", "Declined", "Referred"code(string) - Decision code for categorization/trackingmessage(string) - Decision reason/messageauthorityLevel(string, optional) - Authority level required ("Level 1","Level 2"or"Level 3"; default"", no authority needed)
Alternatively, pass a single decision object with properties: decision, code, message, authority
Returns
- null
Environment Variables Updated
UnderwriterDecisions- Array of decision objects
Example
// Accept automatically
$AddUnderwriterDecision("Valid", "STD-001", "Standard risk profile");
// Require manual review
$AddUnderwriterDecision("Referred", "HVC-002", "High value claim history", "Level 1");
// Decline
$AddUnderwriterDecision("Declined", "AGE-001", "Applicant below minimum age");
// Using object notation
decision = {
"decision": "Declined",
"code": "RISK-HIGH",
"message": "Unacceptable risk level",
"authority": ""
};
$AddUnderwriterDecision(decision);
$Decline¶
Declines a quote with a code and reason.
Signature
Parameters
code(string) - Decline code for categorizationreason(string) - Decline reason/message
Returns
- null (adds decision to UnderwriterDecisions)
Example
if (customerAge < 18) {
$Decline("AGE-MIN", "Applicant must be 18 or older");
}
if (previousClaims > 5) {
$Decline("CLM-EXCESSIVE", "Excessive claim history - unacceptable risk");
}
if (!hasValidLicense) {
$Decline("LIC-INVALID", "Valid driving license required");
}
$Referral¶
Refers a quote for manual underwriting review.
Signature
Parameters
code(string) - Referral code for categorizationreason(string) - Referral reason/messageauthorityLevel(string) - Authority level required ("Level 1","Level 2"or"Level 3")
Returns
- null (adds referral decision)
Example
if (itemValue > 10000) {
$Referral("VAL-HIGH", "High value item - requires underwriter approval", "Level 1");
}
if (unusualRisk) {
$Referral("RISK-UNUSUAL", "Non-standard risk profile", "Level 1");
}
if (complexCase) {
$Referral("CASE-COMPLEX", "Multiple risk factors require senior review", "Level 3");
}
Multi-Level Referrals¶
For complex organizational hierarchies, route to specific authority levels:
$Level1Referral¶
Routes to Level 1 underwriter (basic authority).
Signature
Parameters
code(string) - Referral code for categorizationreason(string) - Referral reason/message
Returns
- null
Example
if (premium > 5000) {
$Level1Referral("PREM-L1", "Premium exceeds Level 1 authority limit");
}
if (minorModifications) {
$Level1Referral("MOD-MINOR", "Vehicle modifications require Level 1 review");
}
$Level2Referral¶
Routes to Level 2 underwriter (mid-level authority).
Signature
Parameters
code(string) - Referral code for categorizationreason(string) - Referral reason/message
Returns
- null
Example
if (premium > 10000) {
$Level2Referral("PREM-L2", "Premium exceeds Level 2 authority limit");
}
if (significantClaimHistory) {
$Level2Referral("CLM-SIG", "Significant claim history requires Level 2 review");
}
$Level3Referral¶
Routes to Level 3 underwriter (senior authority).
Signature
Parameters
code(string) - Referral code for categorizationreason(string) - Referral reason/message
Returns
- null
Example
if (premium > 25000) {
$Level3Referral("PREM-L3", "Premium requires senior underwriter approval");
}
if (exceptionalCircumstances) {
$Level3Referral("CASE-EXCEPTIONAL", "Exceptional case requires senior authority");
}
Endorsements¶
$AddEndorsement¶
Adds an endorsement (special condition or exclusion) to the policy.
Signature
$AddEndorsement(code, description)
$AddEndorsement(endorsementObject)
$AddEndorsement(description) // Legacy
Parameters
code(string) - Endorsement codedescription(string) - Endorsement descriptionendorsementObject(object) -{ "code": string, "description": string }- Legacy form: a single string is added with code
"Legacy"and is also written toOutputendorsements
Returns
- Output object
Environment Variables Updated
Endorsements- Array of endorsement objectsQuotePublicData.endorsementsOutput- Endorsements (legacy form only)
Duplicates
An endorsement whose code and description both match an existing one is ignored. Endorsements that share only the code or only the description are both added.
Example
// Add exclusion
$AddEndorsement("EX01", "Flood damage excluded");
// Add special condition
$AddEndorsement("SC05", "Alarm system required - certificate must be provided within 14 days");
// Multiple endorsements
$AddEndorsement("EX03", "Professional use excluded");
$AddEndorsement("SC12", "Maximum single item value: £2,500");
Complete Underwriting Workflow¶
// Underwriting rules engine
function UnderwriteQuote(customer, items, premium) {
// Age validation
if (customer.Age < 18) {
$Decline("AGE-MIN", "Applicant must be 18 or older");
return;
}
if (customer.Age > 80) {
$Level1Referral("AGE-MAX", "Applicant age over 80 - requires review");
return;
}
// Claim history check
if (customer.ClaimCount > 3) {
$Level1Referral("CLM-MULTIPLE", "Multiple previous claims - " + customer.ClaimCount.ToString() + " claims");
return;
}
if (customer.ClaimCount > 5) {
$Decline("CLM-EXCESSIVE", "Excessive claim history - unacceptable risk");
return;
}
// High value items
highValueItems = items.Filter((item) => item.Value > 5000);
if (highValueItems.Length > 0) {
$Level2Referral("VAL-HIGH", "High value items present - requires valuation");
$AddEndorsement("SC20", "Proof of value required for items over £5,000");
}
// Premium thresholds
if (premium > 25000) {
$Level3Referral("PREM-L3", "Premium exceeds £25,000 - senior approval required");
return;
} else if (premium > 10000) {
$Level2Referral("PREM-L2", "Premium exceeds £10,000");
return;
}
// Security requirements
if (customer.SecurityLevel < 3) {
$AddEndorsement("SC08", "BS3621 locks required on all external doors");
$AddEndorsement("SC09", "Burglar alarm required - certificate of installation needed");
}
// Professional use check
if (customer.ProfessionalUse) {
$Level1Referral("USE-PROF", "Professional use declared");
$AddEndorsement("EX05", "Business use excluded unless specifically agreed");
}
// Accept if no issues
$AddUnderwriterDecision("Valid", "STD-ACCEPT", "Standard risk - auto-accepted");
}
// Execute underwriting
UnderwriteQuote(Customer, Items, PricingMatrix.Premium);
Decision Priority¶
When multiple decisions are added, the most restrictive takes precedence:
- Decline - Quote cannot proceed
- Level 3 Referral - Requires senior approval
- Level 2 Referral - Requires mid-level approval
- Level 1 Referral - Requires basic approval
- Referral (generic) - Requires underwriter review
- Accept - Quote can proceed automatically
// Multiple decisions - Decline takes precedence
$AddUnderwriterDecision("Valid", "LOW-RISK", "Low risk profile");
$Decline("ELIG-FAIL", "Ineligible applicant");
// Result: Quote declined (decline overrides accept)
// Multiple referral levels - highest level required
$Level1Referral("REF-A", "Reason A");
$Level3Referral("REF-B", "Reason B");
// Result: Level 3 referral required
Accessing Decisions¶
Read decisions back from Output.UnderwriterDecisions. Decisions added in the same script can't be read from UnderwriterDecisions: .Filter, $FindEquals and property access on them throw, and only .Length works. Each decision has the keys decision, code, message and authority.
// Check if quote was declined ($FindEquals returns an array, never null)
declined = $FindEquals(Output.UnderwriterDecisions, "decision", "Declined");
if (declined.Length > 0) {
$Log("Quote declined [" + declined[0].code + "]: " + declined[0].message);
}
// Check for any referrals
referrals = Output.UnderwriterDecisions.Filter((d) =>
d.decision == "Referred");
if (referrals.Length > 0) {
$Log("Quote requires referral");
// Display referral reasons
refIndex = 0;
while (refIndex < referrals.Length) {
ref = referrals[refIndex];
refIndex++;
$Log("[" + ref.code + "] " + ref.message + " (Authority: " + ref.authority + ")");
}
}
// Get all endorsements
if (Endorsements != null) {
endorsementIndex = 0;
while (endorsementIndex < Endorsements.Length) {
endorsement = Endorsements[endorsementIndex];
endorsementIndex++;
$Log("Endorsement " + endorsement.Code + ": " + endorsement.Description);
}
}
Complex Decision Logic¶
// Territory-based underwriting
function UnderwriteByTerritory(territoryCode, riskFactors) {
if (territoryCode == "HIGH_RISK") {
// High risk territory rules
if (riskFactors.SecurityScore < 7) {
$Decline("SEC-INSUFF", "Insufficient security in high-risk area");
return;
}
$AddEndorsement("SC15", "24-hour alarm monitoring required");
$Level2Referral("TERR-HIGH", "High risk territory - enhanced security confirmed");
} else if (territoryCode == "MEDIUM_RISK") {
// Medium risk territory
if (riskFactors.SecurityScore < 5) {
$Level1Referral("SEC-MED", "Security below threshold for medium-risk area");
}
$AddEndorsement("SC08", "BS3621 locks required");
} else {
// Low risk territory - standard acceptance
$AddUnderwriterDecision("Valid", "TERR-LOW", "Low risk territory");
}
}
UnderwriteByTerritory(Customer.TerritoryCode, RiskFactors);
Integration with Quote Flow¶
// Complete quote with underwriting
function ProcessQuote() {
// Calculate premium
$CalculatePremiumAdditive("New business");
// Run underwriting
UnderwriteQuote(Customer, Items, PricingMatrix.Premium);
// Check decision
declined = $FindEquals(Output.UnderwriterDecisions, "decision", "Declined");
if (declined.Length > 0) {
return {
"Status": "Declined",
"Code": declined[0].code,
"Reason": declined[0].message,
"Premium": null
};
}
referrals = Output.UnderwriterDecisions.Filter((d) =>
d.decision == "Referred");
if (referrals.Length > 0) {
return {
"Status": "Referred",
"Reasons": referrals.Map((r) => ({ "code": r.code, "message": r.message, "authority": r.authority })),
"Premium": PricingMatrix.Premium,
"Endorsements": Endorsements
};
}
// Accepted
return {
"Status": "Accepted",
"Premium": PricingMatrix.Premium,
"Endorsements": Endorsements,
"MonthlyPayment": Output.Monthly.MonthlyAmount
};
}
result = ProcessQuote();
Best Practices¶
1. Clear Decline Reasons¶
Always provide specific, actionable decline reasons with meaningful codes:
// ✅ Good - specific code and clear message
$Decline("AGE-UNDER18", "Applicant age 17 - must be 18 or older to purchase policy");
// ❌ Poor - vague code and message
$Decline("ERR", "Age issue");
2. Appropriate Referral Levels¶
Route to the correct authority level with appropriate codes:
// Minor issues → Level 1
if (premium > 5000) {
$Level1Referral("PREM-STD", "Premium over standard limit");
}
// Significant issues → Level 2
if (claimCount > 3) {
$Level2Referral("CLM-ASSESS", "Multiple claims require assessment");
}
// Major issues → Level 3
if (premium > 25000) {
$Level3Referral("PREM-HIGH", "High value policy requires senior approval");
}
3. Document Endorsements¶
Use clear endorsement descriptions:
// ✅ Good - actionable
$AddEndorsement("SC08", "BS3621 locks required on all external doors - certificate required");
// ❌ Poor - unclear
$AddEndorsement("SC08", "Locks");
4. Order Decisions Logically¶
Check for decline conditions first:
// ✅ Good - declines checked first
if (age < 18) { $Decline("AGE-MIN", "Below minimum age"); return; }
if (premium > 10000) { $Level2Referral("PREM-L2", "Premium exceeds limit"); return; }
$AddUnderwriterDecision("Valid", "STD-ACCEPT", "Standard acceptance");
// ❌ Poor - might accept then decline
$AddUnderwriterDecision("Valid", "STD", "Accepted");
if (age < 18) { $Decline("AGE", "Too young"); } // Too late!
Environment Variables¶
| Variable | Type | Description |
|---|---|---|
UnderwriterDecisions |
Array | All underwriting decisions |
Endorsements |
Array | Policy endorsements/conditions |
Next Steps¶
- Quote Calculation Functions - Integrate underwriting with pricing
- Examples - Complete underwriting workflow