getContextVariable()
The getContextVariable() function (client-side) retrieves processing context data within a configuration environment.
Syntax
Use this syntax for the getContextVariable() function:
getContextVariable('name');
Return Value
Depending on the requested context variable, the getContextVariable() function returns one of the following values:
-
A string
-
trueorfalse -
undefined
Parameters
The getContextVariable() function accepts a single string parameter, name, which specifies the context variable to retrieve. The table includes the value that the name parameter can take.
|
name Parameter Value |
Description |
Returned Value Type |
|---|---|---|
|
dateFormat |
Date format used in user preferences. |
String |
|
entityRef |
Customer ID in a transaction |
String |
|
isNew |
Indicates whether the configuration is new or opened in edit mode. |
|
|
linenum |
Value of the SO-WO Line Number field |
String |
|
oid |
Transaction ID |
String |
|
productId |
Product ID |
String |
|
rectype |
Transaction Type (for example, |
String |
|
standalone |
Indicates whether the product started in standalone mode. |
|
|
startFromExternal |
Indicates whether the product is used in external mode. |
true | false |
Examples
The following examples show how to use for the getContextVariable() function.
Determining the Product Launch Mode
This example show how to determine whether the product has been launched in standalone mode either by clicking the Standalone button on the product record or through CPQ > Configurator > Standalone.
const contextVar = getContextVariable('standalone');
console.log(contextVar);
Suppose the product was launched in standalone mode, the function returns the following value:
'T'