Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
How do I apply invoice with advInterCompanyJournalEntry using REST API?
I have been applying credit memo successfully as shown below, but I couldn't find a way to apply Invoice as well against AICJE?
Can someone help me point in right direction?
const applyPayload = {
"amount": creditTotal,
"apply": true,
"doc": {
"links": [],
"id": response.id,
"refName": response.id
},
"due": creditTotal,
"total": creditTotal,
"line": 3,
"type": "Journal"
};
console.log("Payload for applying journal entry to credit memo:", applyPayload);
const applyResponse = await utils.patchData(`/services/rest/record/v1/creditmemo/${creditMemoId}/apply/doc=${response.id},line=3`, applyPayload);
if (applyResponse) {
console.log(`[CreateJournalEntry] Journal entry applied successfully to credit memo ${creditMemoId}`);
return response.id;
} else {
throw new Error(`Failed to apply journal entry to credit memo ${creditMemoId}`); 0