I have deveoped suitelet script to show textarea type field. I am populating sublist based on entered textarea field values. I am getting entered textarea field values from client script saverecord to suitelet and populate the suitelet sublist.Populating sublist in Get only.
Now, the challenge is, when I click on submit button, entered textarea values go away. User may enter value with new line/space/comma/pipe seperator. I want to show same values with same seperator in textarea field after clcickng on submit button.
Here is suitelet script sample, if (context.request.method === 'GET') { var form = serverWidget.createForm({ title: 'CON Numbers', hideNavBar: false });
form.clientScriptFileId = CLIENT_SCRIPT_FILE_ID;
var pageId = parseInt(context.request.parameters.page) || 0;
var scriptId = context.request.parameters.script;
var deploymentId = context.request.parameters.deploy;
var cidnParam = context.request.parameters.cidn;
var download = context.request.parameters.download; // Check for download parameter
var sublist = form.addSublist({
id: 'custpage_table',
type: serverWidget.SublistType.LIST,
label: 'Sales Order Items'
});
sublist.addField({ id: 'id', label: 'Internal ID', type: serverWidget.FieldType.TEXT });
var cidnField = form.addField({
id: 'custpage_enter_cidn',
label: 'Enter CON Numbers',
type: serverWidget.FieldType.TEXTAREA
});
form.addSubmitButton({
id: 'custpage_submit',
label: 'Submit'
});
context.response.writePage(form);
}
}
The value of custpage_enter_cidn
will get submitted with the form, so you can grab its value from the parameters
during a POST request just like you do with pageId
, scriptId
, etc.
Get the value of custpage_enter_cidn
from the parameters
, then set that as the defaultValue
of cidnField
.
See details on the defaultValue
property.