Show answerHide answer
Correct answer: A Add a getter in CostEnhancement: property get TotalCost_Ext() : BigDecimal { return this.TotalPremium + this.Tax }
Explanation
Answer Option (Which option is correct) A. Add a getter in CostEnhancement: property get TotalCost_Ext() : BigDecimal { return this.TotalPremium + this.Tax }Explanation:
A getter derives a value when it is read and can be reused from multiple callers. This is appropriate for a total calculated from existing amounts or a primary email chosen by a fallback rule. A setter assigns state, and a persisted duplicate of a derived value creates synchronization work.
Why the other options are incorrect:
B. Create an entity enhancement and add: property set TotalCost_Ext(totalCost : BigDecimal){ totalCost = this.TotalPremium + this.Tax }:
A setter accepts an assigned value. This requirement reads a calculated total. A getter returns the sum without assignment.
C. Create an entity extension and add a new field to store the total cost:
A stored total duplicates premium and tax information. It must be updated whenever either component changes. The requested dynamic getter avoids that duplicated state.
D. Calculate the total cost in the value property in the PCF file:
A PCF expression computes the value in one interface location. Other callers cannot reuse that expression directly. The enhancement getter provides a shared property.
References:
Gosu language project - Operators, loops, functions, and properties
Guidewire - Query-backed collections and buildBaseQuery