Martin
03/14/2025, 9:57 PMCeligo AI
03/14/2025, 9:57 PMAI generated answer (using internal Slack threads):Based on the conversations, here is an example of how you can create a cash sale transaction using SuiteScript 2.x:
javascript
var record = require('N/record');
var cashSaleRecord = record.create({
type: record.Type.CASH_SALE,
isDynamic: true,
});
cashSaleRecord.setValue({
fieldId: 'entity',
value: '123' // replace with actual customer internal id
});
cashSaleRecord.setValue({
fieldId: 'paymentmethod',
value: '4' // replace with actual payment method internal id
});
cashSaleRecord.setValue({
fieldId: 'account',
value: '200' // replace with actual account internal id
});
var lineNum = cashSaleRecord.selectNewLine({
sublistId: 'item'
});
cashSaleRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'item',
value: '567' // replace with actual item internal id
});
cashSaleRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity',
value: 1
});
cashSaleRecord.commitLine({
sublistId: 'item'
});
var cashSaleId = cashSaleRecord.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
This script creates a new cash sale record, sets the customer, payment method, and account, adds a line item, and then saves the record. Please replace the placeholder values with actual internal ids.
******
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
03/14/2025, 9:58 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836048126
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.823783875
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822946429
Celigo AI
03/14/2025, 9:58 PM