Newer Version Available
setParametersAsJSON(jsonString)
Signature
public void setParametersAsJSON(String jsonString)
Parameters
- jsonString
- Type: String
- The custom parameters that you need to set, serialized into a JSON format string.
Return Value
Type: Void
Usage
Use this method to set the current custom parameters for the canvas app. The parameters must be provided in a JSON string. You can use the System.JSON.serialize(objectToSerialize) method to serialize a map into a JSON string.
Setting the custom parameters will overwrite the custom parameters that are set for the current request. If you need to modify the current custom parameters, first get the current set of custom parameters by using getParametersAsJSON(), modify the retrieved parameter set as needed, and then use this modified set in your call to setParametersAsJSON().
If the provided JSON string exceeds 32KB, a System.CanvasException will be thrown.
Example
This example gets the current custom parameters, adds a new newCustomParam parameter with a value of ‘TESTVALUE’, and sets the current custom parameters.