guidewiregosu

Guidewire PolicyCenter 10: Alternative to deprecated setFieldValue() method


I'm currently working on an on-premise setup of Guidewire PolicyCenter 10 (latest version).

In multiple places across our codebase, we are using the following pattern to dynamically set field values on entities:

entity.setFieldValue("Name", "Demo Name")

However, in the newer versions of PolicyCenter, the setFieldValue() method is marked as deprecated.

I understand that for a static use case like the one above, we can directly set the field, e.g.:

document.Name = "Demo Name"

But in our PolicyCenter implementation, we have several utility classes where field names and values are passed as key–value pairs, and the method dynamically sets these on different entities.

The Guidewire documentation only mentions that setFieldValue() is deprecated, but it does not specify any recommended replacement or migration approach.

So my questions are:

What is the recommended alternative to setFieldValue(fieldName, value) for dynamically setting entity fields?

Is it still safe to use setFieldValue() in on-prem PolicyCenter 10 implementations (non-cloud) without upgrade issues?

For future Guidewire Cloud upgrades, would continuing to use setFieldValue() cause compatibility or performance issues?

Any official reference or recommended best practice would be greatly appreciated.


Solution

  • As per Guidewire below are the alternative for setFieldValue maskEntityType.IntrinsicType.TypeInfo.getProperty("AssignedRisk").Accessor.setValue(maskEntityType, true)

    or

    target.IntrinsicType.TypeInfo.getProperty(fieldName).Accessor.setValue(target, srcEntity.getFieldValue(field.Name))