redirect.toRecordTransform(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Transforms a record to a standard or custom transaction instance. The fromId and fromType parameters can be acquired from the context object provided by the onAction(scriptContext) method of a workflow action script. The toType record type identifier cannot be acquired programmatically and must be entered manually.

The new transaction instance opens in edit mode with all possible fields defaulted from the source record. To specify URL parameters or record field values on the redirected page, use the options.parameters parameter. For record field values, use the record.fieldId format. Invalid keys are ignored. The user can edit transaction details before saving.

For a list of supported transformation types, see Supported Transformation Types.

Returns

void

Supported Script Types

Server scripts

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

Governance

None

Module

N/redirect Module

Sibling Module Members

N/redirect Module Members

Since

2020.1

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.fromId

number

required

The ID of the source record.

options.fromType

string

required

The ID of the source record type.

options.toType

string

required

The ID of the target record type.

options.parameters

Object

optional

Contains additional parameters as key-value pairs.

Errors

Error Code

Error Message

Thrown If

INVALID_RCRD_TYPE

The record type ‘type’ is invalid.

The record type specified in the toType parameter is invalid.

INVALID_RCRD_TRANSFRM

That type of record transformation is not allowed. Please see the documentation for a list of supported transformation types.

Transformation between the fromType and toType record types is not allowed.

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/redirect Module Script Sample.

            // Add additional code
...
define(['N/redirect'], function (redirect) {
    return {
        onAction: function (context)
        {
            redirect.toRecordTransform({
                fromType: context.newRecord.type,
                fromId: context.newRecord.id,
                toType: 'invoice',
                parameters: {
                    'record.memo': 'memo override', // override of memo field on body form
                    'cf':'92' // std product invoice custom form
                }
            });
        },
    }
});
...
// Add additional code 

          

Related Topics

N/redirect Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices