dataset.createJoin(options)

Note:

The content in this help topic applies to SuiteScript 2.x.

Method Description

Creates a dataset join. Multi-level, inverse, and polymorphic joins can be created. Joins can be used when you create a dataset column.

For more information about using joins in a dataset in SuiteAnalytics, see the help topic, Joining Record Types in a Dataset.

Returns

dataset.Join

Supported Script Types

Server scripts

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

Governance

None

Module

N/dataset Module

Sibling Module Members

N/dataset Module Members

Since

2020.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.fieldId

string

required

The ID of the record field for the join.

When you perform a join, you must specify the field to be used to perform the join. For example, consider a transaction record. Transaction records can be joined to customer records using the entity field on the transaction record. If you joined a transaction record to a customer record in this way, the value of this property is 'entity'.

options.join

dataset.Join

optional

The existing join used to a create multi-level join.

Use this parameter only if a child join exists with the current join as its parent.

options.source

string

optional

The internal ID for the source record type for the join used to create an inverse join.

Use the Records Catalog to find the Internal ID of scriptable records.

options.target

string

optional

The polymorphic target of the join.

Errors

Error Code

Thrown If

MUTUALLY_EXCLUSIVE_ARGUMENTS

Both the options.source and options.target parameters are specified.

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/dataset Module Script Samples.

            // Add additional code
...
// Create a basic Join
var myNameJoin = dataset.createJoin({
    fieldId: 'name'
});

// Create an inverse Join
var myInverseJoin = dataset.createJoin({
    fieldId: 'phone',
    source: 'contact'
});

// Create a polymorphic Join
var myPolymorphicJoin = dataset.createJoin({
    fieldId: 'phone',
    target: 'entity'
});

// Create a multi-level Join
var myMultiLevelJoin = dataset.createJoin({
    fieldId: 'phone',
    join: myNameJoin
});
...
// Add additional code 

          

Related Topics

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

General Notices