Contains all the methods for custom scripting on a context manager
- Source:
Methods
-
.clear(options)
-
Triggers the clear functionallity of a context manager.
Parameters:
Name Type Description options
Object Specify the options for this function.
Properties
Name Type Description componentId
String Specify the id of the context manager.
- Source:
Example
CSL.contextManager.clear({ componentId: sourceId });
-
.getContextValue(options)
-
Retrieves the value for a context field.
Parameters:
Name Type Description options
Object Specify the options for this function.
Properties
Name Type Description fieldName
String Specify the name of the field.
- Source:
Returns:
Returns the value for that field or undefined if it was not found in the context.
- Type
- *
Example
var productId = CSL.contextManager.getContextValue({ fieldName: "Product Id" });
-
.getFullContext()
-
Retrieves all the context that has been set.
- Source:
Returns:
Returns an object that is a key-value pair of fields with their values.
- Type
- Object
Example
var allContext = CSL.contextManager.getFullContext();
-
.search(options)
-
Triggers the search functionallity of a context manager.
Parameters:
Name Type Description options
Object Specify the options for this function.
Properties
Name Type Description componentId
String Specify the id of the context manager.
- Source:
Example
CSL.contextManager.search({ componentId: sourceId });
-
.setContextValue(options)
-
Sets one or more context fields.
Parameters:
Name Type Description options
Object Specify the options for this function.
Properties
Name Type Description context
Object Specify a context object. The key should be the name of the view field. The value is the value to set as context.
- Source:
Example
// Sets the value of the product name context field to Bubble gum. CSL.contextManager.setContextValue({ context: { "product name": "Bubble gum" } });