Inventory Cost Revaluation

The inventory cost revaluation record is used to recalculate the value of items configured to use standard costing.

This record is available when the Standard Costing feature is enabled at Setup > Company > Enable Features, on the Items & Inventory subtab. When the feature is enabled, you can access the inventory cost revaluation record in the UI by choosing Transactions > Inventory > Revalue Inventory Cost.

For help working with this record in the UI, see Manually Entering an Inventory Cost Revaluation and Revalue Standard Cost Inventory.

The internal ID for this record is inventorycostrevaluation.

See the SuiteScript Records Browser for all internal IDs associated with this record. For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

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

Supported Script Types

The inventory cost revaluation record is scriptable in both client SuiteScript and Server SuiteScript.

All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.

Supported Functions

The inventory cost revaluation record can be created, updated, copied, deleted, and searched using SuiteScript.

Code Samples

The following sample shows how to create and update inventory cost revaluation records.

          function inventoryCostRevaluation(){

    var recId = null;

    var newId = null;

    var recType = record.Type.INVENTORY_COST_REVALUATION;

    try {

        // Create the record

        var revaluationRec = record.create({

            type: recType,

            isDynamic: true

        });

        revaluationRec.setValue({

            fieldId: 'subsidiary',

            value: '1'

        });

        revaluationRec.setValue({

            fieldId: 'item',

            value: itemId1             // Some assembly item

        });

        revaluationRec.setValue({

            fieldId: 'account',

            value: '1'

        });

        revaluationRec.setValue({

            fieldId: 'location',

            value: '1'

        });

        revaluationRec.setSublistValue({

            sublistId: 'costcomponent',

            fieldId: 'cost',

            line: 1,

            value: '2'

        });

        revaluationRec.setSublistValue({

            sublistId: 'costcomponent',

            fieldId: 'componentitem',

            line: 1,

            value: componentItemId1         // Some inventory item

        });

        revaluationRec.setSublistValue({

            sublistId: 'costcomponent',

            fieldId: 'quantity',

            line: 1,

            value: '3'

        });



        recId = revaluationRec.save(); 



        var revaluationAddedRec = recordload({

            type: recType,

            id: recId

        });



        // Update

        // Note you cannot change subsidiary and item

        revaluationAddedRec.setValue({

            fieldId: 'account',

            value: '2'

        });

        revaluationAddedRec.setSublistValue({

            sublistId: 'costcomponent',

            fieldId: 'quantity',

            line: 1,

            value: '5'

        });

        recId2 = revaluationAddedRec.save();



        var revaluationUpdatedRec = record.load({

            type: recType,

            id: recId2

        });



        // Copy

        var copiedRecord = record.copy({

            type: recType,

            id: recId

        });

        var newId = copiedRecord.save();

        copiedRecord = record.load({

            type: recType,

            id: newId

        });



        var mySearch = search.create({

            type: recType, 

            columns: [{

                name: 'memo',

            }, {

                name: 'subsidiary'

            }],

            filters: [{

                name: 'memo',

                operator: 'contains',

                value: 'em'

            }]

        });



        log.debug({

            details: ''+arguments.callee.name +' passed.'

        });

    }

    catch (e) {

        log.error({

            details: ''+arguments.callee.name +' failed.'

        });

    }

    finally{

        if (recId != null){

            record.delete({

                type: recType,

                id: recId

            });

        }

        if (newId != null){

            record.delete({

                type: recType,

                id: newId

            });

        }

    }

} 

        

Related Topics

General Notices