client scripting and ui workflow for Inbound Shipm...
# ask-stanley-ai
a
client scripting and ui workflow for Inbound Shipment. The sublists don't seem to have the same APIs available, so what's the right way to read data from them in a script or workflow?
c
AI generated answer (using internal Slack threads):
In order to read data from sublists in a script or workflow for Inbound Shipment, you need to use the appropriate SuiteScript APIs. The APIs available for sublists can vary depending on the type of sublist. For client scripts, you can use the
N/currentRecord
module to get the current record and then use the
getSublistValue
method to read data from a sublist. Here is an example:
Copy code
javascript
var currentRecord = require('N/currentRecord');
var record = currentRecord.get();
var sublistValue = record.getSublistValue({
    sublistId: 'items',
    fieldId: 'item',
    line: 0
});
For workflows, you can use the
Set Field Value
action to read data from a sublist. You need to specify the sublist and field ID in the action parameters. If you are dealing with a custom sublist, you might need to use a different approach. You can use a search to get the data from the custom sublist. Here is an example:
Copy code
javascript
var search = require('N/search');
var mySearch = search.create({
    type: 'customrecord_my_custom_record',
    filters: [
        ['custrecord_parent_record', 'anyof', myRecordId]
    ],
    columns: ['custrecord_my_field']
});
var searchResults = mySearch.run().getRange({start: 0, end: 100});
Remember that the
getSublistValue
method and the
Set Field Value
action might not work with some types of sublists. In these cases, you might need to use a different method or action, or use a search as described above. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849998772
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.847721457
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846444488
Please provide your feedback on this answer.