We can’t pass an array through the URL as parameters. So, you can use the following approach to overcome this problem.
When adding parameter in URL:
let testArr=["yellow", "green", "blue"];
let tesURL=https://test.com;
//join the array element by using the "," delimiter.
let testArrStr=testArr.join(",")//"yellow,green,blue"
//add the testArrStr as parameter to pass the testArr
let testURL=tesURL+"?"+testArrStr;
https.get({url:testURL});
When retrieving the parameters from the URL:
function onRequest(context){
let testArrStr = context.request.parameters.testArrStr;//"yellow,green,blue"
let testArr=testArrStr.split(",");//["yellow", "green", "blue"]
}
Use cases:
- When using suitelet page with multi select field as a filter option. In this case when reloading the page with client script. you can use this approach to pass the multi select field values back to suitelet page.