Landed Cost

The landed cost subrecord supports the Landed Cost Allocation per Line functionality, which is part of the Landed Cost feature. Landed costs typically include location-specific expenses such as customs duties and freight fees. The landed cost subrecord can be used in conjunction with several transactions: check, credit card charge, item receipt, and vendor bill. The purpose of the subrecord is to show the landing costs associated with a particular line in the parent transaction’s Items sublist.

The subrecord is available only when the Landed Cost feature is enabled at Setup > Company > Setup Tasks > Enable Features, on the Items & Inventory subtab.

For help working with this record in the UI, see Using Landed Cost Allocation Per Line on Transactions.

The internal ID for this subrecord is landedcost.

Important:

Landed cost is considered a subrecord, not a record. For general details on working with subrecords, see Subrecord Scripting Overview. For details about this finding information for subrecords in the Record Browser, see Finding Subrecord Details in the Records Browser.

For information about scripting with this record in SuiteScript, see the following help topics:

Supported Script Types

The landed cost subrecord is scriptable in server SuiteScript only. The user events are not supported.

Supported Functions

The landed cost subrecord is fully scriptable, which means that it can be created, updated, copied, deleted, and searched using SuiteScript.

Usage Notes

To script to the landed cost subrecord, both of the following must be true:

Code Samples

The following sample shows how to create a landed cost subrecord and perform other basic tasks.

          // Creating a landed cost subrecord
var purchaseOrder = record.create({
    type: record.Type.PURCHASE_ORDER,
    isDynamic: true
});
purchaseOrder.setText({
    fieldId: 'entity',
    text: 'Acme Medical Supply'
});
purchaseOrder.setSublistValue({
    sublistId: 'item',
    fieldId: 'item',
    line: 1,
    value: inventoryItemId                 // defined outside this snippet
});
       
var purchaseOrderId = purchaseOrder.save();
       
var itemReceipt = record.transform({
    fromtype: record.Type.PURCHASE_ORDER,
    fromId: purchaseOrderId,              // defined outside this snippet
    toType: record.Type.ITEM_RECEIPT
});
itemReceipt.selectLine({
    sublistId: 'item',
    line: 1
});
itemReceipt.setCurrentSublistValue({
    sublistId: 'item',
    fieldId: 'location',
    value:1
});
itemReceipt.setValue({
    fieldId: 'landedcostperline',
    value: 'T'
});

var landedCost = itemReceipt.getCurrentSublistSubrecord({
    sublistId: 'item',
    fieldId: 'landedcost'
});
landedCost.selectNewLine({
    sublistId: 'landedcostdata'
});
landedCost.setCurrentSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'costcategory',
    value: 1
});
landedCost.setCurrentSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'amount',
    value: 456
});
landedCost.commitLine({
    sublistId: 'landedcostdata'
});
landedCost.selectNewLine({
    sublistId: 'landedcostdata'
});
landedCost.setCurrentSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'costcategory',
    value: 3
});
landedCost.setCurrentSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'amount',
    value: 78.96
});
landedCost.commitLine({
    sublistId: 'landedcostdata'
});
itemReceipt.commitLine({
    sublistId: 'item'
});
       
var itemReceiptId = itemReceipt(save);

// Viewing the subrecord
itemReceipt = record.load ({
    type: record.Type.ITEM_RECEIPT,
    id: itemReceiptId
});
itemReceipt.selectLine({
    sublistId: 'item',
    line: 1
});
landedCost = itemReceipt.getSublistSubrecord({
    sublistId: 'item',
    fieldId: 'landedcost',
    line : 1
});
landedCost.getSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'amount',
    value: 1
});

// Updating the subrecord
landedCost = itemReceipt.getCurrentSublistSubrecord({
    sublistId: 'item',
    fieldId: 'landedcost'
});
landedCost.removeLine({
    sublistId: 'landedcostdata',
    line: 2
});

landedCost.setSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'costcategory',
    line: 1,
    value: 2
});
landedCost.setSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'amount',
    line: 1,
    value: 3.98
});
landedCost.selectNewLine({
    sublistId: 'landedcostdata'
});
landedCost.setCurrentSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'costcategory',
    value: 3
});
landedCost.setCurrentSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'amount',
    value: 103
});
landedCost.commitLine({
    sublistId: 'landedcostdata'
});
itemReceipt.commitLine({
    sublistId: 'item'
});
var receiptId = itemReceipt.save();

// Deleting the subrecord
itemReceipt.selectLine({
    sublistId: 'item',
    line   : 1
});
itemReceipt.removeCurrentSublistSubrecord({
    sublistId: 'item',
    fieldId: 'landedcost'
});
itemReceipt.commitLine({
    sublist: 'item'
});
var receiptId2 = itemReceipt.save(); 

        

Related Topics

Using Landed Cost Allocation Per Line on Transactions
Landed Cost Overview
Working with the SuiteScript Records Browser
SuiteCloud Supported Records
Transactions

General Notices