Set param values
You can assign value to a non-user defined configuration parameter in your extension. This can be accomplished in two different methods, as outlined below:
You can assign values to the created configuration parameter by using the widget method
Steps to set the value for the configuration parameter using widget.
- In your local drive, go to your Project folder which you created initially while constructing your widget.
- Open the widget.html file.
- Edit the file and configure the request client API by providing the necessary parameters. Use the given sample request as a reference. Specify the name of the configuration parameter and the corresponding value that should be passed.
- Save the file
- Pack and publish the extension.
Now the parameter and its value will be updated.
Note: The non-userdefined param only can be updated by set client API.
Sample Request
CopiedZOHODESK.set("extension.config",{ name : "token", value : "mytoken" }).then((response)=>{
console.log(response["extension.config"]);
// your code here...
}).catch(error=>{
//handle error here...
})
To configure the parameter values using Functions, follow the steps provided below.
- Go to Sigma > Functions > Add Function > Create your function.
In the Deluge Script Builder page, provide the given sample request to set the data.
Request
URL : https://desk.zoho.com/api/v1/installedExtensions/{{installationId}}/configParams OAuth Scope : Desk.extensions.CREATE RequestMethod : POST RequestHeaders : orgId, Authorization
Save the function.
You will get the response as shown:
Response
ResponseCode : 200 Content-Type : application/json Response : #CONFIG_PARAM_API_RESPONSE_OBJECT
- Associate function with the extension.
- Publish the extension.
Now, the parameter name and its value will be updated.
Copiedhead = Map();
head.put("orgId", data.get('integ_scope_id'));
installationId = data.get('service_app_id');
ApiKey=data.get("ApiKey");
configParams = Map();
configVariables = Map();
configVariables.put("name","ApiKey");
configVariables.put("value",ApiKey);
configParamsList = Collection();
configParamsList.insert(configVariable);
configParams.put("variables",configParamsList);
//Set config Param
addConfigParam = invokeurl
[
url: "https://desk.zoho.com/api/v1/installedExtensions/"+installationId+"/configParams"
type: POST
parameters: configParams.toString()
headers: head
content-type: "application/json"
connection: "testing"
];