I have a multiselect field in the GET section of my suitelet and I am trying to use the value of this field in the POST section.
Here is my multiselect field in the GET section as it is populated by an Object:
var marketplacesList = form.addField('selectedmarketplaces','multiselect','Marketplaces',null,'part3');
for (var k in marketplaces){
marketplacesList.addSelectOption(k,marketplaces[k].label);
}
Then when I log the value in the POST section as such:
var selectedMarkets = request.getParameter('selectedmarketplaces'); //gets a multiselect from GET section
nlapiLogExecution('DEBUG','selectedMarkets',selectedMarkets);
I get the following string:
"amazonComamazonUKamazonCAamazonFRamazonDEamazonITamazonJPamazonESebayComebayUkebayAuebayVolt"
How do I make the value of the multiselect an array so I can use it for iteration, etc.?
Thanks,
Do it like this:
var selectedMarkets = request.getParameter('selectedmarketplaces'); //gets a multiselect from GET section
selectedMarketsArray = selectedMarkets.split("\u0005"); //Turns it into an array
nlapiLogExecution('DEBUG','selectedMarketsArray',JSON.stringify(selectedMarketsArray));