Nour Khaled
04/30/2025, 7:12 AMCeligo AI
04/30/2025, 7:12 AMAI generated answer (using internal Slack threads):To get the value of a field from a suitelet form sublist in SuiteScript, you can use the
getLineItemValue
method. However, if the value is set using jQuery, it might not be accessible in the SuiteScript context. This is because SuiteScript operates server-side, while jQuery operates client-side.
Here's a sample code snippet that demonstrates how to get a value from a sublist:
javascript
var sublistValue = request.getLineItemValue('sublistId', 'custpage_binobj', i);
In this example, 'sublistId' is the ID of the sublist, 'custpage_binobj' is the ID of the field, and 'i' is the line number.
If you're having trouble retrieving the value, make sure that the field is properly set before the form is submitted. If the value is set using jQuery, you might need to use a client script to capture the value and store it in a hidden field that can be accessed by SuiteScript.
For adding a value to a select field inside a sublist, you can use the addSelectOption
method. Here's a sample code snippet:
javascript
var venSub = form.getSublist({ id: 'itemsublist', line: j }).getField({ id: 'vendor' });
venSub.addSelectOption({
value: vendorId,
text: vendorName
});
In this example, 'itemsublist' is the ID of the sublist, 'j' is the line number, 'vendor' is the ID of the select field, and 'vendorId' and 'vendorName' are the value and text of the option to be added, respectively.
Remember to replace the placeholders with your actual values.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
04/30/2025, 7:12 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.85163039
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850695074
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.847325385
Celigo AI
04/30/2025, 7:12 AM