Create Record in SDP Cloud
Table of Contents
Note:
- Each time the zoho.sdp.create integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.sdp.create integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
Overview
The zoho.sdp.create task creates a new record with the given values in the specified module of SDP Cloud.
This integration task is based on the SDP Cloud API - Create Request.
Syntax
<response> = zoho.sdp.create(<module>, <data_map>, <app_account_name>, <connection>);
| Params | Data type | Description |
| <response> | KEY-VALUE | The details of the record that will be created. |
| <module> | TEXT | The name of the module in which the new record will be created. Currently, only "Request" is the applicable module. |
| <data_map> | KEY-VALUE | The values of the new record that will be created. The keys of this parameter should be specified as given in the SDP Cloud API. |
| <app_account_name> | TEXT | The name of the account in which this task will be performed. Note:
|
| <connection> | TEXT | The name of the connection Note:
|
Example
The following script creates a new record with the specified values in the module - Request:
// Create a KEY-VALUE variable to hold the values of the new record recordValue = Map(); recordValue.put("subject", "OS installation"); recordValue.put("requester", {"name":"Shawn"}); recordValue.put("category", {"name":"Operating System"}); recordValue.put("subcategory", {"name":"Windows XP"}); //Execute the integration task to create a new record in the SDP Cloud module - Request response = zoho.sdp.create("Request", recordValue, "", "sdp_connection");
where:
response
"Request"
recordValue
""
"sdp_connection"
Response Format
Success Response
The success response returned will be in the following format:
{
"request": {
"subject": "OS installation",
"resolution": null,
"linked_to_request": null,
"mode": null,
"lifecycle": null,
"is_read": false,
"assets": [
],
"is_trashed": false,
"id": "317XXXXXXXXXX348",
"assigned_time": null,
"group": null,
"requester": {
"email_id": null,
"is_technician": false,
"sms_mail": null,
"phone": null,
"name": "Tom",
"mobile": null,
"id": "317XXXXXXXXXX338",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=-1&t=user&height=60&width=60",
"is_vip_user": false,
"department": null
},
"email_to": [
],
"created_time": {
"display_value": "Sep 20, 2019 05:01 PM",
"value": "1568979088854"
},
"item": null,
"level": null,
"approval_status": null,
"impact": null,
"sla": null,
"resolved_time": null,
"priority": null,
"created_by": {
"email_id": "tom@zylker.com",
"is_technician": true,
"sms_mail": null,
"phone": null,
"name": "Shawn",
"mobile": null,
"id": "3173000000115318",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=58XXXX60&t=user&height=60&width=60",
"is_vip_user": false,
"department": null
},
"first_response_due_by_time": null,
"is_escalated": false,
"last_updated_time": {
"display_value": "Sep 20, 2019 05:01 PM",
"value": "1568979089117"
},
"has_notes": false,
"udf_fields": {
},
"impact_details": null,
"subcategory": {
"name": "Windows XP",
"id": "317XXXXXXXXXX747"
},
"deleted_time": null,
"email_cc": [
],
"status": {
"in_progress": true,
"internal_name": "Open",
"stop_timer": false,
"color": "#0066ff",
"name": "Open",
"id": "317XXXXXXXXXX657"
},
"template": {
"name": "Default Request",
"id": "317XXXXXXXXXX655"
},
"email_ids_to_notify": [
],
"attachments": [
],
"request_type": null,
"display_id": "1",
"time_elapsed": "0",
"notification_status": null,
"description": null,
"responded_time": null,
"is_service_request": false,
"urgency": null,
"has_request_initiated_change": false,
"department": null,
"is_reopened": false,
"has_draft": false,
"has_attachments": false,
"has_linked_requests": false,
"is_overdue": false,
"technician": null,
"has_problem": false,
"due_by_time": null,
"is_fcr": false,
"has_project": false,
"site": null,
"is_first_response_overdue": false,
"completed_time": null,
"email_bcc": [
],
"category": {
"deleted": false,
"name": "Operating System",
"id": "317XXXXXXXXXX705"
}
},
"response_status": {
"status_code": 2000,
"status": "success"
}
}
To fetch the ID of the newly created record from the success response obtained, execute the following snippet:
info <response_variable>.get("request").get("id");
Failure Response
The failure response for incorrect or non-existent record ID will be returned in the following format:
{
"response_status": {
"status_code": 4000,
"messages": [
{
"status_code": 4007,
"type": "failed",
"message": "Invalid URL accessed"
}
],
"status": "failed"
}
}The failure response for incorrect or non-existent field API name will be returned in the following format:
{
"response_status": {
"messages": [
{
"status_code": 4001,
"type": "failed",
"message": "EXTRA_KEY_FOUND_IN_JSON"
}
],
"status": "failed"
}
}The failure response for invalid values against the field API names will be returned in the following format:
{
"response_status": {
"status_code": 4000,
"messages": [
{
"status_code": 4001,
"field": "subcategory",
"type": "failed"
}
],
"status": "failed"
}
}
Related Links
- SDP Cloud API
- Common error codes can be viewed here
- The possible response formats can be viewed here