public String getParametersAsJSON()
Type: String
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.
This example gets the current custom parameters, de-serializes them into a map, and prints the results to the debug log.
Canvas.EnvironmentContext env = renderContext.getEnvironmentContext(); // Get current custom params Map<String, Object> currentParams = (Map<String, Object>) JSON.deserializeUntyped(env.getParametersAsJSON()); System.debug('Environment Context custom paramters: ' + currentParams);