Get Storage Data
You can get the stored data in two ways:
To retrieve the stored data from the connected database of the extension, follow the instructions given below:
- In your local drive, go to your Project folder which you created initially while building your first widget.
- Open widget.html file in app folder, with the help of editor.
- In widget.html file, provide the Request to get the data from database.
This request includes two parameters: key and queriableValue. And the request must include at least one of these parameters.
- Save the file.
- Pack and publish the extension.
Now, the required data will be successfully retrieved from the database. This data can be used to develop the code functionalities of your extension.
Note: If you specify the limit in the given format, the data will be fetched accordingly; otherwise, the first 20 records will be fetched by default.
Sample Request
CopiedWithout Limit:
ZOHODESK.get('database', {queriableValue :'Production_Department'}).then(function(response){
// success response
//response = {"database.get":{"data":[{"queriableValue":"Production_Depart ment","value {"name":"zylker"},"key":"001"}]}}
}).catch(function(err){
// failure response
// {errMsg: 'Invalid Payload'}
})
With Limit:
ZOHODESK.get('database', { queriableValue: 'zoho_desk',from :0,limit:100 })
To fetch the stored data via functions, follow the steps given below:
- Go to Sigma > Functions > Add Function > Create your function.
In the function editor, provide the given sample request.
In this request, a connection will be used to store the data. For that connection, scopes should hold the value 'Desk.extensions.ALL'.
- Save the function.
- Associate function with the extension.
- Publish the extension.
Now, the data will be successfully retrieved from the database by calling this function. This data can be used effectually for developing your extension.
Sample Request
Copiedhead = Map();
head.put("orgId", data.get('integ_scope_id'));
installationId = data.get('service_app_id');
storage = invokeurl
[
url: "https://desk.zoho.com/api/v1/installedExtensions/"+installationId+"/storage?key=001&queriableValue=Production_Department"
type: GET
headers: head
connection: "testing"
];