Created a userpicker in a custom datautility and regiseterd it on a string attribute. Picker renders correctly in UI. On selecting user clicking finish windchill throws error for custom callback function saying that we cannot set value for null. Also mc.getRawValue() always returns null in the below code.
//Get datavalue method of datautilty
public Object getDataValue(String component_id, Object object, ModelContext mc) throws WTException {
buildUserPickerConfig(component_id, mc);
Object localObject = null;
System.out.println(mc.getRawValue());
if (mc.getRawValue() != null)
{
localObject = mc.getRawValue();
defaultProps.put(PickerRenderConfigs.DEFAULT_HIDDEN_VALUE, localObject.toString());
} else
{
localObject = "";
}
PickerInputComponent pic = new PickerInputComponent("UserPicker",localObject.toString(), defaultProps);
pic.setColumnName(component_id);
return pic;
}
//Callback JS
function userPickerCallback(objects, pickerID)
{
var updateHiddenField = document.getElementById(pickerID);
alert(updateHiddenField);
var myJSONObjects = objects.pickedObject;
for(var i=0; i< myJSONObjects.length;i++) {
var oid = myJSONObjects[i].oid;
alert(oid);
// Here “fullName” is the displayAttribute requested
updateHiddenField.value=oid;
}
}
Error Screenshot.