Skip to main content
Dec 21, 2022 10:05 AM UTC
Solved

Not able to get attribute value on picker callback function from custom JSP page.

Hi All, I'm stuck on a problem where im not able to get the custom attribute on the picker callback, the tags and the scripts written in the jsp page is as specified below.

 

Tag written in the jsp page.

 

<wctags:itemPicker
id="pickerID"
objectType="WCTYPE|wt.doc.WTDocument|Type1|Type2"
componentId="pickerID"
searchResultsViewId="pickerID.view"
label="Submitter"
pickerTitle="Picker Title"
pickerCallback="PickerCallback1"
pickedAttributes="number,attrInternalName1,attrInternalName2,attrInternalName3"
/>

 

<script>
function PickerCallback1(objects,pickerID)
{
var myJSONObjects = objects.pickedObject;
for (var i = 0; i < myJSONObjects.length; i++) {
var str = JSON.stringify(myJSONObjects[i]);
alert(str);
var fullName = myJSONObjects[i]["attrInternalName1"];
alert(fullName);
}
}

</script>

 

Output on alert : "undefined"

 

@HelesicPetr @BjoernRueegg 

Jan 6, 2023 10:30 AM UTC

<tr><wctags:itemPicker id="pickerid" objectType="WCTYPE|wt.doc.WTDocument|Type1|Type2" componentId="pickerid" searchResultsViewId="Picker.view" label="Submitter" pickerTitle="Customer Picker" pickerCallback="PickerCallback1" displayAttribute="number,org.CustomerName,orgCustomerNumber,org.AddressID"/></tr>

 

Picked attributes are not required, only display attributes are required.

 

This worked.

3 replies

Dec 21, 2022 10:14 AM UTC

Sorry, haven't used any custom pickers jet.

 

By the way, it would make it easier for any reader to insert code instead copy/paste text:

bmr_0-1671617656649.png

 

Dec 21, 2022 10:44 AM UTC

Thanks, noted.

Manoj_Dokku4AuthorAnswer
Jan 6, 2023 10:30 AM UTC

<tr><wctags:itemPicker id="pickerid" objectType="WCTYPE|wt.doc.WTDocument|Type1|Type2" componentId="pickerid" searchResultsViewId="Picker.view" label="Submitter" pickerTitle="Customer Picker" pickerCallback="PickerCallback1" displayAttribute="number,org.CustomerName,orgCustomerNumber,org.AddressID"/></tr>

 

Picked attributes are not required, only display attributes are required.

 

This worked.