Project Work Breakdown Structure Macros

The project work breakdown structure record type currently supports the getAmountsFields, setAmountFieldValue, getAmountFieldValue, and getUnmatchedActuals macros.

For help working with this record in the UI, see Project Work Breakdown Structure (WBS) and Budget vs. Actual Report.

For information about SuiteScript 2.x record macros, see the following help topics:

getAmountsFields

Corresponding UI Button

Get Amounts Fields

Macro Description

Gathers the contents of all amounts field names.

Returns

Objects

Supported Script Types

Client and server scripts

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

Since

2020.1

Parameters

The getAmountsFields macro does not require any additional parameter.

Work Breakdown Structure getAmountsFields Macro Syntax

The following code sample returns objects:

            {
            fields: [
                     '11_2019_cost_etc',
                     '11_2019_revenue_etc',
                     '11_2019_actual_etc',
                     '11_2019_actual_etc',]
} 

          

The following code sample returns all field IDs which can be used in other macros:

            require(['N/currentRecord'], function (currentRecord){
            var record = currentRecord.get();

            var amountsFields = record.executeMacro({
                     id: 'getAmountsFields'
            });
}); 

          

setAmountFieldValue

Corresponding UI Button

Set Amount Field Value

Macro Description

Sets amount field.

Returns

No object

Supported Script Types

Client and server scripts

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

Since

2020.1

Parameters

See Record.executeMacro(options) for details about parameters required for the execution of any macro. The setAmountFieldValue macro also requires the following additional parameters:

Errors

See the following table for details about the setAmountFieldValue macro errors:

Error

Thrown If

INVALID_FLD_VALUE

Invalid value type

SSS_MISSING_REQD_ARGUMENT

Required argument is missing or undefined

SSS_COLUMN_DOES_NOT_EXIST

Invalid fieldId

YOU_HAVE_ATTEMPTED_AN_UNSUPPORTED_ACTION

Trying set value for unsupported fields (EAC, ACTUAL)

SSS_INVALID_SUBLIST_OPERATION

Invalid lineIndex argument

Work Breakdown Structure setAmountFieldValue Macro Syntax

The following code sample updates ETC amount for the first line:

            require(['N/currentRecord'], function (currentRecord){
            var record = currentRecord.get();

            record.executeMacro({
                        id: 'setAmountFieldValue',
                        params: {
                                 lineIndex: 0,
                                 fieldId: '01_2020_cost_etc',
                                 value: 100
                        }
            });
}); 

          

getAmountFieldValue

Corresponding UI Button

Get Amount Field Value

Macro Description

Gets amount field.

Returns

Objects

Supported Script Types

Client and server scripts

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

Since

2020.1

Parameters

See Record.executeMacro(options) for details about parameters required for the execution of any macro. The getAmountFieldValue macro also requires the following additional parameters:

Parameter

Type

Required / Optional

Description

Since

lineIndex

number

required

Line's index (indexed from 0)

2020.1

fieldId

string

required

field's id (obtained from the getAmountFields macro, only etc field is supported)

2020.1

value

number

required

Value

2020.1

Errors

See the following table for details about the getAmountFieldValue macro errors:

Error

Thrown If

SSS_MISSING_REQD_ARGUMENT

Required argument is missing or undefined

SSS_COLUMN_DOES_NOT_EXIST

Invalid fieldId

SSS_INVALID_SUBLIST_OPERATION

Invalid lineIndex argument

Work Breakdown Structure getAmountFieldValue Macro Syntax

The following code sample returns an object:

            {
            field: '01_2020_cost_etc',
            value: 25.5
} 

          

The following code sample returns the ETC amount for the first line:

            require(['N/currentRecord'], function (currentRecord){
            var record = currentRecord.get();

            var etcCost = record.executeMacro({
                     id: 'getAmountFieldValue'
                     params:   {
                              lineIndex: 0,
                              fieldId: '01_2020_cost_etc'
                     }
            });
}); 

          

getUnmatchedActuals

Corresponding UI Button

Get Unmatched Actuals

Macro Description

Gets unmatched actuals.

Returns

Objects

Supported Script Types

Client and server scripts

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

Since

2020.1

Parameters

The getUnmatchedActuals macro does not require any additional parameter.

Work Breakdown Structure getUnmatched Actuals Macro Syntax

The following code sample returns an object:

            {
            cost: 800
            revenue: 1000
} 

          

The following code sample returns unmatched actual cost and actual revenue:

            require(['N/currentRecord'], function (currentRecord){
            var record = currentRecord.get();

            var unmatchedActuals = record.executeMacro({
            });
}); 

          

Related Topics

Using Billing Rate Cards
Billing and Invoices
Using Billing Classes
Working with the SuiteScript Records Browser
SuiteScript Supported Records
Lists

General Notices