How do I create a transfer order using the API?
# ask-stanley-ai
i
How do I create a transfer order using the API?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it appears that creating a
Transfer
record programmatically in NetSuite is not directly supported via SuiteScript, SuiteTalk, or the REST API. The
Transfer
record type does not appear in the
record.Type
enumeration, and attempts to search for or load them using the type "transfer" have been unsuccessful. However, there are alternative ways to programmatically move funds between accounts. If the accounts are non-bank accounts, you can use a Journal Entry (JE), which can be scripted. For bank accounts, it seems that creating a custom transaction might be a possible solution, although this would require more advanced knowledge of NetSuite customization. Here is a general example of how you might create a Journal Entry:
Copy code
javascript
var journalEntry = record.create({
    type: record.Type.JOURNAL_ENTRY,
    isDynamic: true
});

journalEntry.setValue({
    fieldId: 'subsidiary',
    value: 1
});

journalEntry.setValue({
    fieldId: 'currency',
    value: 1
});

journalEntry.selectNewLine({
    sublistId: 'line'
});

journalEntry.setCurrentSublistValue({
    sublistId: 'line',
    fieldId: 'account',
    value: 1000 // replace with your account id
});

journalEntry.setCurrentSublistValue({
    sublistId: 'line',
    fieldId: 'debit',
    value: 100 // replace with your transfer amount
});

journalEntry.commitLine({
    sublistId: 'line'
});

journalEntry.selectNewLine({
    sublistId: 'line'
});

journalEntry.setCurrentSublistValue({
    sublistId: 'line',
    fieldId: 'account',
    value: 2000 // replace with your other account id
});

journalEntry.setCurrentSublistValue({
    sublistId: 'line',
    fieldId: 'credit',
    value: 100 // replace with your transfer amount
});

journalEntry.commitLine({
    sublistId: 'line'
});

var journalEntryId = journalEntry.save();
Please replace the account ids and transfer amount with your actual values. This script creates a new Journal Entry and sets the subsidiary and currency. It then adds two lines, one for the debit account and one for the credit account, with the transfer amount. ****** 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.847683966
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837145805
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831848443
Please provide your feedback on this answer.
Thank you for your feedback
i
I see there is a rest API for transfer orders. Why can't we use that one?