I am trying to pass values entered in a textarea field on suitelet (new line/space/comma/pipe separated) from client script to suitelet. There is limitation of suiteleturl length. I am trying to pass those values as a array on values to suitelet url. In future user may enter more than 100 numbers in a textarea field. that may be problematic.
This is client script function to pass entered cdn numbers via parameters from client script to suitelet script.
function submitCDN() {
var cdnInput = document.getElementById('custpage_enter_cdn').value;
// Split the input string into an array, handling various separators
var cidnArray = cdnInput.split(/[\n\s,\|]+/).filter(function(item) {
return item.trim() !== ''; // Remove empty entries
});
// Construct the Suitelet URL with the CIDN array
var suiteletUrl = url.resolveScript({
scriptId: document.getElementById('script').value, // Assuming script id is on the form.
deploymentId: document.getElementById('deploy').value, // Assuming deploy id is on the form.
params: {}
});
// Append the CIDN array to the URL with square brackets
suiteletUrl += '&cidn=' + cidnArray.map(encodeURIComponent).join('&cdn=');
alert("suiteletUrl="+suiteletUrl);
// Redirect to the Suitelet
window.location.href = suiteletUrl;
}
Suitelet URL Log is, suiteletUrl=/app/site/hosting/scriptlet.nl?script=1234&deploy=1&compid=5678_SB&&cdn=11238734&cdn=74567654
An alternative approach would be to store those values in a custom record, then pass the internal ID of that custom record as a parameter to the Suitelet. Inside the Suitelet, you can use that internal ID to load the custom record and retrieve the stored values as needed. This keeps the URL clean and help manage larger data set more efficiently.