BOM Revision

A BOM revision enables you to update a BOM’s details throughout the product lifecycle. A BOM revision also provides an accessible revisions history. Use revisions to compare and track cost savings when many BOM revisions are used in production. This record is available when the Advanced BOM feature is enabled at Setup > Company > Enable Features, on the Items & Inventory tab. For information about this feature, see Advanced Bill of Materials.

In the UI, this record is accessed by going to Lists > Supply Chain > Bill of Materials.

For help working with this record in the UI, see BOM Revision.

The internal ID for this record is bomrevision.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Note:

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 BOM Revision record is scriptable in server SuiteScript only.

Supported Functions

The BOM Revision record is fully scriptable, which means that it can be read, created, edited, copied, deleted, and searched using SuiteScript.

BOM Revision Code Samples

Create a BOM Revision

The following sample shows how to create a new bill of materials revision record.

          require(['N/record'], function(record){
    function createBomRevision(values, items){
        var rec = record.create({
            type: 'bomrevision', isDynamic: true
        });
        for (var key in values){
            if (values.hasOwnProperty(key)){
                rec.setValue({
                    fieldId: key,
                    value: values[key]
                });
            }
        }
        for (var itemIndex in items){
            rec.selectNewLine({
                sublistId: 'component'
            });
            for (var key in items[itemIndex]){
                if (items[itemIndex].hasOwnProperty(key)){
                    rec.setCurrentSublistValue({
                        sublistId: 'component',
                        fieldId: key,
                        value: items[itemIndex][key]
                    });
                }
            }
            rec.commitLine({sublistId: 'component'});
        }
        return rec.save({enableSourcing: false, ignoreMandatoryFields: false});
    }

    var bomRevisionId = createBomRevision({
        'billofmaterials': 1,
        'name': 'Rev.1',
        'effectivestartdate': new Date('1/1/2017')
           }, [
            {'item': 63, 'bomquantity': 1},
            {'item': 62, 'bomquantity': 2}
    });
}); 

        

Search for a BOM Revision

The following sample shows how to search for a bills of materials revision record.

          require(['N/search'],function(search){
    function getBomRevisions(bomId){
        // search ids for all revisions for given BoM
        var searchObj = search.create({
            type: 'bomrevision',
            filters: [{
                name: 'billofmaterials',
                operator: search.Operator.IS,
                values: [bomId]
            }],
            columns: ['name']
        });
        var revisions = [];
        searchObj.run().each(function(result) {
            revisions.push({
                'id': result.id,
                'name': result.getValue('name')
            });
            return true;
        });
        return revisions;
    }
    var revisions = getBomRevisions(1);
}); 

        

Update a BOM Revision

The following sample shows how to update a bills of materials revision record.

          require(['N/record'], function(record){
    function updateBomRevision(revisionId, values){
        var rec = record.load({
            type: 'bomrevision',
            id: revisionId
        });
        for (var key in values){
            if (values.hasOwnProperty(key)){
                rec.setValue({
                    fieldId: key,
                    value: values[key]
                });
            }
        }
        return rec.save({enableSourcing: false, ignoreMandatoryFields: false});
    }
    updateBomRevision(1, {
        'effectiveenddate': new Date('12/31/2018')
      });
}); 

        

Related Topics

General Notices