recordContext.getContext(options)
Method Description |
Returns the record context object for a given record. The parameters you specify for this method depend on whether the record is currently loaded in your script:
|
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Since |
2020.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required if the record is not loaded in your script |
The record type. |
2020.2 |
|
string |
required if the record is not loaded in your script |
The internal ID of the record. |
2020.2 |
|
required if the record is loaded in your script |
The record object. |
2020.2 |
|
|
Array<string> |
optional |
The context type to retrieve. See recordContext.ContextType. |
2020.2 |
Errors
Error Code |
Thrown If |
---|---|
|
The record is present alongside a record ID or record type. |
|
Any of the record ID or record type parameter is missing. |
|
The parameter type is wrong. |
|
The context type selection is unknown. |
|
The record type selection is invalid or not supported. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/recordContext Module Sample.
// Add additional code
// Sample code on getting context for records that are not loaded
...
var employeeContext = recordContext.getContext({
recordType: record.Type.EMPLOYEE,
recordId: employeeId
contextTypes: [recordContext.ContextType.LOCALIZATION]
...
// Add additional code
// Add additional code
// Sample code on getting context for records that are loaded
...
var lrc = recordContext.getContext({
record: recordObject,
contextTypes: [recordContext.ContextType.LOCALIZATION]
...
// Add additional code