Array of Objects and List Selection as fetchData parameter Problem

Hi

I have a problem like i am not able to send request data to web service.
I have requirement to send input as following:

<search_criteria>
            <productName>?</productName>
            <prodId>?</prodId>
            <plant>
               <plantId>?</plantId>
            </plant> 
 	<plant>
               <plantId>?</plantId>              
            </plant>
            <plant>
               <plantId>?</plantId>              
            </plant>  
</search_criteria>

I have tried like following
listGrid.fetchData({search_criteria :{productName:DynamicForm0.getValue(‘productName’),
prodId:DynamicForm0.getValue(‘prodId’),isc.addProperties(plantGrid.getSelection())}});

If i send productName and prodId i am able to get response … but i am not able to send multiple plant info.
In this case is it possible to send multiple plants(Objects) as array ? I have ListGrid for plants how to send selected list items in fetchData method?
Pls help.

I got the solution for formatting but still i am facing problem to include the selection dynamically in fetchData method…

listGrid.fetchData({search_criteria :{productName:DynamicForm0.getValue(‘productName’),
prodId:DynamicForm0.getValue(‘prodId’),plant:[???])}});
How to get selected values of the grid, its not accepting string for fetchData method.

plant:[{plantId:‘64’},{plantId:‘65’}]

Hi gurugubelli,

grid.getSelection() returns an Array of the selected ListGridRecords, which are ordinary JavaScript Objects. You can iterate down that Array and form a new Array where each object has just the property you want (plantId).

Note that if you are able to change the XML that your service expects, you might want to simplify it to:

<plantId>?</plantId>
<plantId>?</plantId>
<plantId>?</plantId>
<plantId>?</plantId>

Which would be the result of:

plant:plantGrid.getSelection().getProperty("plantId")