productionCharges.updateChargesToCustomUnitCost(options)

Method Description

Updates cost on a specific transaction line to a specified unit cost.

This method applies to transaction lines that must:

  • be a credit line

  • be of type Non-Inventory, Service or Other Charge

  • use items designated for Purchase or Resale

  • use items whose cost category is not of type Outsourcing Charge, Landed, or Service

Returns

void

Supported Script Types

Server scripts.

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/manufacturing/productionCharges Module

Since

2026.1

Parameters

Parameter

Type

Required / Optional

Description

options.transactionId

number

required

ID of transaction to be updated.

options.transactionLineIds

number[]

required

Array of IDs of lines to be updated.

options.newUnitCost

number

required

New unit cost of item on transaction line.

options.isUnitCostPerBaseUnit

boolean

optional

Default value is true.

When true, for lines with Multiple Units of Measure feature enabled, the value of options.isUnitCostPerBaseUnit will be applied as the unit cost of the base unit.

When false, options.isUnitCostPerBaseUnit will be applied as a fixed unit cost value irrespective of any Multiple Units of Measure conversion rates applicable.

Important:

This parameter can only be used when the Multiple Units of Measure feature is enabled. For more information, see Enabling Multiple Units of Measure.

Errors

Error Code

Message

Thrown If

INVALID_NUMBER_MUST_BE_GREATER_THAN_1

Invalid number (must be greater than 0)

The value of options.transactionId or options.transactionLineIds is not a positive integer.

FEATURE_1_MUST_BE_ENABLED_TO_USE_2_API

Feature 'Assembly Items' must be enabled to use 'N/manufacturing/productionCharges' API.

Assembly Items feature is not enabled.

PREFERENCE_1_REQUIRED_FOR_THIS_OPERATION

Preference Allow bulk cost updates for Production Charges required for this operation.

Allow bulk cost updates for Production Charges preference is not enabled.

ACCESS_DENIED

Access denied

The user does not have at least Edit permission for the following transactions:

  • if Manufacturing Work In Process feature is disabled: Build Assemblies

  • if Manufacturing Work In Process feature is enabled: Assembly Build, Work Order Completion and Work Order Issue

For more information, see Setting Permissions.

TRANSACTION_1_IS_INVALID_OR_HAS_NO_EDITABLE_TRANSACTION_LINES

Transaction with ID '{1: transaction ID}' is invalid or has no transaction lines that can be edited through this API

Transaction does not exist or does not meet the following criteria:

  • is of type Assembly Build, Work Order Completion or Work Order Issue

  • is in an open posting period

  • has at least one transaction line that is editable by this API

PROVIDED_TRANSACTION_LINES_ARE_NOT_EDITABLE_OR_INVALID_1

Provided transaction lines are invalid or cannot be edited through this API: [{1: transaction line IDs separated by commas}]

Transaction line(s) does not exist or does not meet the following criteria:

  • is a credit line (has quantity less than 0)

  • item on transaction line is of type Non-Inventory Item, Service or Other Charge

  • the cost category of the item on the transaction line is not of type Outsourcing Charge, Landed, or Service

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/manufacturing/productionCharges Module Samples.

          //Add additional code 
...
require(["N/manufacturing/productionCharges"], function(productionCharges){
    productionCharges.updateChargesToCustomUnitCost({
        transactionId: 58,
        transactionLineIds: [9],
        newUnitCost: 3
    });
});
...
//Add additional code 

        

Related Topics

General Notices