Vishal Chaudhari
06/11/2025, 8:45 AMCeligo AI
06/11/2025, 8:45 AMAI generated answer (using internal Slack threads):To create a Suitelet to update item inventory details, you can use the
record
module in SuiteScript 2.0. Here is a basic example of how you can do this:
javascript
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
*/
define(['N/record', 'N/ui/serverWidget'], function(record, serverWidget) {
function onRequest(context) {
if (context.request.method === 'GET') {
var form = serverWidget.createForm({
title: 'Update Inventory Details'
});
// Add fields and buttons as needed
// ...
context.response.writePage(form);
} else {
var itemId = context.request.parameters.itemId;
var newInventoryCount = context.request.parameters.newInventoryCount;
var inventoryItem = record.load({
type: record.Type.INVENTORY_ITEM,
id: itemId
});
inventoryItem.setValue({
fieldId: 'custitem_inventory_count',
value: newInventoryCount
});
inventoryItem.save();
context.response.write('Inventory updated successfully.');
}
}
return {
onRequest: onRequest
};
});
This Suitelet creates a form where you can input the item ID and the new inventory count. When the form is submitted, it loads the item record, updates the inventory count, and saves the record.
Please replace 'custitem_inventory_count'
with the actual field ID of your inventory count field.
Remember to deploy the Suitelet and set up the appropriate permissions.
******
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
06/11/2025, 8:45 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840562344
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83037132
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829803407
Celigo AI
06/11/2025, 8:45 AM