YASSER
12/06/2024, 8:25 AMCeligo AI
12/06/2024, 8:25 AMAI generated answer (using internal Slack threads):To show the linked invoice date and number in a sales order, you can use a SuiteScript. You can create a user event script that triggers on the creation of an invoice. This script would fetch the invoice date and number, then update the related sales order with this information. Here is a basic example of how you might structure this script:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/record'], function(record) {
function afterSubmit(context) {
if (context.type !== context.UserEventType.CREATE) return;
var invoice = context.newRecord;
var invoiceDate = invoice.getValue('trandate');
var invoiceNumber = invoice.getValue('tranid');
var salesOrderId = invoice.getValue('createdfrom');
if (salesOrderId) {
var salesOrder = record.load({
type: record.Type.SALES_ORDER,
id: salesOrderId
});
salesOrder.setValue('custbody_invoice_date', invoiceDate);
salesOrder.setValue('custbody_invoice_number', invoiceNumber);
salesOrder.save();
}
}
return {
afterSubmit: afterSubmit
};
});
In this script, custbody_invoice_date
and custbody_invoice_number
are custom fields on the Sales Order record where you want to store the invoice date and number. You would need to create these fields in your NetSuite account before running the script.
Please note that this script assumes that the invoice is created from a sales order. If the invoice is not created from a sales order, the createdfrom
field will be empty and the script will not do anything.
******
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
12/06/2024, 8:25 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830275595
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826934099
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82476306
Celigo AI
12/06/2024, 8:25 AM