feat: add insurance dynamic rule migration (surcharge + underwriting)#114
Open
cottonandcolor wants to merge 6 commits into
Open
feat: add insurance dynamic rule migration (surcharge + underwriting)#114cottonandcolor wants to merge 6 commits into
cottonandcolor wants to merge 6 commits into
Conversation
… underwriting Add two new commands to convert Insurance BRE dynamic rules to CML: - `sf cml convert surcharge-rules` reads ProductSurcharge.RuleDefinition - `sf cml convert underwriting-rules` reads UnderwritingRule.DynamicRuleDefinition Both convert eligibility-only ruleCriteria into CML boolean constraints, generate .cml files, association CSVs, and RuleKey mapping JSON. Shared conversion logic extracted into insurance-rule-converter.ts. Tested against a live org with 6 surcharge and 9 underwriting rules.
- Type-aware condition dispatch: use attributeName for Attribute type, contextTagName for Tag type (prevents SalesTransactionItemAttribute sentinel leak) - Proper In/NotIn: expand multi-value to OR'd equality checks - Contains/DoesNotContain: use strcontain() CML function - criteriaExpressionType: respect ALL (AND) vs default OR between criteria - attributeId: pass through to CmlAttribute for dual-lookup resolution - Picklist dataType: map to string in CML - collectAttributes: preserve attributeId and proper CML data type per attribute - rootObjectId: prefer per-criteria rootObjectId over record ProductPath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new commands to convert Insurance BRE dynamic rules to CML eligibility constraints:
sf cml convert surcharge-rules— readsProductSurcharge.RuleDefinitionfrom org or JSON filesf cml convert underwriting-rules— readsUnderwritingRule.DynamicRuleDefinitionfrom org or JSON fileBoth convert
ruleCriteriaconditions into CML boolean constraints (eligibility-only, no actions), outputting.cml,_Associations.csv, and_RuleKeyMapping.jsonfiles. Import uses the existingsf cml import as-expression-setcommand.Files added
src/shared/insurance-rule-converter.ts— shared criteria→constraint conversion, product code resolutionsrc/commands/cml/convert/surcharge-rules.ts— surcharge commandsrc/commands/cml/convert/underwriting-rules.ts— underwriting commandmessages/cml.convert.surcharge-rules.md— help textmessages/cml.convert.underwriting-rules.md— help textcommand-snapshot.json— updated with new commandsContext
Insurance dynamic rules (surcharge/underwriting) use the same
ruleCriteriaschema as Configurator rules but are stored on different entities (ProductSurcharge.RuleDefinition,UnderwritingRule.DynamicRuleDefinition) and are eligibility-only (pass/fail, no actions like AutoAdd/SetAttribute). The Insurance-Chewbacca team is adding CML support for surcharges in Core (W-21817142).Example output
Test plan
sf cml convert surcharge-rulesagainst live org (6 rules converted)sf cml convert underwriting-rulesagainst live org (9 rules converted)yarn buildpasses (lint + compile + snapshot)sf cml import as-expression-seton a 264+ org with RuleEngineType field