How to create Intercompany Sales Order via Scripti...
# ask-stanley-ai
j
How to create Intercompany Sales Order via Scripting?
c
AI generated answer (using internal Slack threads):
To create an Intercompany Sales Order via SuiteScript, you would first need to create an Intercompany Purchase Order. After creating the Intercompany Purchase Order, you can then transform this into a Sales Order. Here is a sample code snippet that demonstrates how you can create an Intercompany Purchase Order and then transform it into a Sales Order:
Copy code
javascript
var po = record.create({
    type: record.Type.PURCHASE_ORDER,
    isDynamic: true
});
// set fields on the purchase order
po.setValue('subsidiary', subsidiaryId);
po.setValue('entity', entityId);
// more fields to set...

var poId = po.save();

var so = record.transform({
    fromType: record.Type.PURCHASE_ORDER,
    fromId: poId,
    toType: record.Type.SALES_ORDER
});
// set fields on the sales order
so.setValue('intercotransaction', poId);
// more fields to set...

var soId = so.save();
Please note that you will need to replace
subsidiaryId
and
entityId
with the actual IDs of the subsidiary and entity for the transaction. Also, you may need to set more fields depending on your specific requirements. After creating the Sales Order, you can pair it to the Purchase Order through the "intercotransaction" field. ****** 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.888415158
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.878213763
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.866430163
Please provide your feedback on this answer.