Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

getParametersAsJSON()

Retrieves the current custom parameters for the canvas app. Parameters are returned as a JSON string.

Signature

public String getParametersAsJSON()

Return Value

Type: String

Usage

Use this method to get the current custom parameters for the canvas app. The parameters are returned in a JSON string that can be de-serialized by using the System.JSON.deserializeUntyped(jsonString) method.

Custom parameters can be modified by using the Canvas.EnvironmentContext.setParametersAsJSON(jsonString) string.

Example

This example gets the current custom parameters, de-serializes them into a map, and prints the results to the debug log.

1Canvas.EnvironmentContext env = renderContext.getEnvironmentContext();
2
3// Get current custom params
4Map<String, Object> currentParams = 
5    (Map<String, Object>) JSON.deserializeUntyped(env.getParametersAsJSON());
6System.debug('Environment Context custom paramters: ' + currentParams);