cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

ReferenceError: CustomPickerInputComponentCallback is not defined

SL_10932999
7-Bedrock

ReferenceError: CustomPickerInputComponentCallback is not defined

I am using Windchill PDMLink Release 12.1 and Datecode with CPS 12.1.2.0

I created a custompicker data utility to search for parts of selected softype & was able to bind the datautility to IBA in Part creation wizard. From Create wizard, on clicking searchpicker the results are generated as expected & able to select a result. But when clicking 'OK', getting error "ReferenceError: CustomPickerInputComponentCallback is not defined". The custom pickercall back is defined in custom.jsfrag & deployed as per CS71276 & windchill-all.js also got updated as expected. Fllowed CS29555 to clear cache as well, but error is still persisting. Note : The datautility is working fine when OOTB pickercallback is referred in datautility.

1. Need help to understand the reason for this error & steps to resolve them.
2. Need help to understand the steps to set IBA value from picked object instead of its OIR to Picker component attribute from create part wizard.

Here are the errors that I faced
It seems that you have not defined the callback function or the there is some error in it: CustomPickerInputComponentCallback exception: ReferenceError: CustomPickerInputComponentCallback is not defined
ACCEPTED SOLUTION

Accepted Solutions

Hello Petr,
Apologies. it was resolved by clearing browser cache as due to cached windchill-all.js, still non latest version was being referred, causing the error.

1. created a java utility with reference to custom callback.

		HashMap<String, Object> customProps = new HashMap<String, Object>();
		if ("internalnameofcustomAttribute".equalsIgnoreCase(component_id)) 
			customProps.put("pickerId",component_id);
			customProps.put("pickerCallback", "CustomPickerInputComponentCallback");

2. the  custom callback is defined in custom.jsfrag 

function CustomPickerInputComponentCallback(objects,pickerID,attr,displayFieldId)
{
    var updateHiddenField=document.getElementsByName(pickerID)[0];
    var updateDisplayField=document.getElementsByName(displayFieldId)[0]; 
    if(updateDisplayField)
	{
		PTC.util._setMainFormStartingElement(updateDisplayField);
    }
	var myJSONObjects=objects.pickedObject;
    for(var i=0;i<myJSONObjects.length;i++)
    {var oid=myJSONObjects[i].oid;
	var displayAttr=myJSONObjects[i][attr];
	updateHiddenField.value=displayAttr;
    updateDisplayField.value=displayAttr;
	} 

}

 

View solution in original post

2 REPLIES 2

Hi @SL_10932999 

Did you define the callback in your code?

something like

 

customProps.put("pickerCallback", "CustomPickerInputComponentCallback");

 

if so, have you defined this as a js script in your jsp page? so it can be called from jsp?

Example:

HelesicPetr_0-1728393512430.png

 

PetrH

Hello Petr,
Apologies. it was resolved by clearing browser cache as due to cached windchill-all.js, still non latest version was being referred, causing the error.

1. created a java utility with reference to custom callback.

		HashMap<String, Object> customProps = new HashMap<String, Object>();
		if ("internalnameofcustomAttribute".equalsIgnoreCase(component_id)) 
			customProps.put("pickerId",component_id);
			customProps.put("pickerCallback", "CustomPickerInputComponentCallback");

2. the  custom callback is defined in custom.jsfrag 

function CustomPickerInputComponentCallback(objects,pickerID,attr,displayFieldId)
{
    var updateHiddenField=document.getElementsByName(pickerID)[0];
    var updateDisplayField=document.getElementsByName(displayFieldId)[0]; 
    if(updateDisplayField)
	{
		PTC.util._setMainFormStartingElement(updateDisplayField);
    }
	var myJSONObjects=objects.pickedObject;
    for(var i=0;i<myJSONObjects.length;i++)
    {var oid=myJSONObjects[i].oid;
	var displayAttr=myJSONObjects[i][attr];
	updateHiddenField.value=displayAttr;
    updateDisplayField.value=displayAttr;
	} 

}

 

Announcements

Top Tags