Configuring rating worksheet with costs that is not calculated in rate book.
I want to add the costs information to the rating worksheet. There are some costs I created without using Rate book or rate routines. Is there a way to add them to worksheet entry so I can properly show them in Quote screen - Rating Worksheet popup ?
Yes, this is possible using the gw.rating.worksheet.WorksheetLogger class. You don't mention what release of PolicyCenter you're working with but this capability has been there for some time, although it's litely documented.
Here is the link to the documentation where it describes this at a high level. There is "ootb" example of this embedded in class gw/rating/flow/util/SharedRatingFunctions.gs.
https://docs.guidewire.com/cloud/pc/202310/config/config/pc/topics/c_ge1398278.html
To provide a more concrete example, here's a fragment of code from the SharedRatingFunctions class that demonstrates how to capture activity.
var log = WorksheetLogger.get()
// var upperBound = priorValue + allowedChangeAmount
var upperBound = log.let("upperBound", \ -> log.Term.vr("priorValue", priorValue) + log.Addition.vr("allowedChangeAmount", allowedChangeAmount) )
// var lowerBound = priorValue - allowedChangeAmount
var lowerBound = log.let("lowerBound", \ -> log.Term.vr("priorValue", priorValue) - log.Subtraction.vr("allowedChangeAmount", allowedChangeAmount) )
// var capped = value.min(upperBound)
var capped = log.let("capped", \ -> log.Term.startFn(BigDecimal, "min", null, "value", value).calcValue(value.min(log.argVar("value", "upperBound", upperBound))))
// capped = capped.max(lowerBound)
capped = log.store("capped", \ -> log.Term.startFn(BigDecimal, "max", null, "capped", capped).calcValue(capped.max(log.argVar("value", "lowerBound", lowerBound))))
// return capped
return log.retrn(\ -> log.Term.vr("capped", capped))