Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

Created user picker using datautility throws error on callback function.

$
0
0

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.

Screen Shot 05-28-15 at 11.09 AM.JPG


Viewing all articles
Browse latest Browse all 3592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>