Aaron McCausland
10/15/2025, 3:29 PMCeligo AI
10/15/2025, 3:29 PMAI generated answer (using internal Slack threads):When you transform a Sales Order to an Invoice using
Record.transform(), the Due Date doesn't automatically update based on the Terms field as it does when Terms are selected in the UI. This is because the Record.transform() function does not automatically calculate and set the Due Date based on the Terms field.
To get the Due Date to initialize in this scenario, you need to manually calculate the Due Date based on the Terms field and set it in the transformed record. Here is a sample code snippet:
javascript
var invoiceRecord = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: so.id,
toType: record.Type.INVOICE
});
// Calculate the Due Date based on the Terms field
var terms = invoiceRecord.getValue({fieldId: 'terms'});
var dueDate = calculateDueDateBasedOnTerms(terms); // You need to implement this function
// Set the Due Date in the transformed record
invoiceRecord.setValue({
fieldId: 'dueDate',
value: dueDate
});
var invoiceId = invoiceRecord.save();
Please note that you need to implement the calculateDueDateBasedOnTerms() function to calculate the Due Date based on the Terms field. This function should take the Terms field value as input and return the calculated Due Date.
******
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
10/15/2025, 3:29 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835388184
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831970274
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828796387
Celigo AI
10/15/2025, 3:29 PMCeligo AI
10/15/2025, 3:30 PMAaron McCausland
10/15/2025, 4:26 PM