### Send GET Request with Query Parameters Source: https://www.zohocrm.dev/explore/client-script/zrc/zrc_methods This example demonstrates how to include query parameters in a GET request using the 'params' option within requestConfig. ```javascript await zrc.get('/crm/v8/Leads', { params: { fields: 'Last_Name,First_Name' } }) ``` -------------------------------- ### ZDK HTTP GET Request Source: https://www.zohocrm.dev/explore/client-script/clientapi/HTTP Use this snippet to initiate a GET request. Ensure the URL and any parameters are correctly specified. ```javascript ZDK.HTTP.request({ url: 'https://zylker.com', method: 'GET', parameters: { query1: 'txt', } }); ``` -------------------------------- ### Example output of getTags() Source: https://www.zohocrm.dev/explore/client-script/clientapi This is an example of the data structure returned by the ZDK.Page.getTags() method, showing an array of tag objects. ```javascript [{ name: 'tag1' }, { name : 'atom' }, { name : 'busy' }] ``` -------------------------------- ### Custom API Request with zrc.request (GET) Source: https://www.zohocrm.dev/explore/client-script/zrc/zrc_methods Make fully customizable API requests with complete control over the method, endpoint, headers, body, and other request configurations. This example shows a GET request. ```javascript const response = await zrc.request({ path: 'https://zylker.com/posts' }); console.log(response); ``` -------------------------------- ### Connection-based GET Request (Google Sheets Example) Source: https://www.zohocrm.dev/explore/client-script/zrc Make a GET request to a third-party service (Google Sheets) using a pre-configured connection. ```APIDOC ## GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId} ### Description Retrieves spreadsheet details from Google Sheets using a specified connection. ### Method GET ### Endpoint https://sheets.googleapis.com/v4/spreadsheets/98711121211100 ### Parameters #### Request Configuration - **connection** (string) - Required - The link name of the connection (e.g., 'google_sheets'). ### Request Example ```javascript const res = await zrc.get('https://sheets.googleapis.com/v4/spreadsheets/98711121211100', { connection: 'google_sheets' }); ``` ``` -------------------------------- ### Get All Leads (Promise Style) Source: https://www.zohocrm.dev/explore/client-script/zrc/code_samples Fetches all leads with specified fields using Promise-based asynchronous operations. ```APIDOC ## Get All Leads (Promise Style) ### Description Fetches all leads with specified fields using Promise-based asynchronous operations. ### Method GET ### Endpoint /crm/v8/Leads ### Query Parameters - **fields** (string) - Required - Comma-separated list of fields to retrieve (e.g., 'Last_Name,First_Name'). ### Request Example ```javascript zrc.get('/crm/v8/Leads', { params: { fields: 'Last_Name,First_Name' } }).then(res => { console.log(res.data.data); }).catch (err => { console.error("Error fetching leads:", err); }); ``` ### Response #### Success Response (200) - **data** (array) - Contains a list of lead objects. ``` -------------------------------- ### Get Picklist Options Source: https://www.zohocrm.dev/explore/client-script/clientapi/Field Retrieves the list of available options for picklist and multi-select picklist fields. ```APIDOC ## getPicklistOptions() ### Description Gets the list of options for picklist and multi-select picklist fields. This is useful for dynamically populating or displaying available choices. ### Method `field_obj.getPicklistOptions()` ### Parameters None ### Request Example ```javascript var field_obj = ZDK.Page.getField('Lead_Status'); field_obj.getPicklistOptions(); ``` ### Response #### Success Response (200) An array of objects, where each object represents a picklist option. - **display_value** (string) - The user-friendly display value of the option. - **actual_value** (string) - The actual value of the option. - **id** (string) - Optional - The unique identifier for the option. - **filtered** (boolean) - Optional - Indicates if the option is filtered. #### Response Example ```json [ {"display_value": "-None-", "actual_value": "-None-"}, {"id": "111111000000014736", "filtered": false, "display_value": "Attempted to Contact", "actual_value": "Attempted to Contact"}, {"id": "111111000000014730", "filtered": false, "display_value": "Contact in Future", "actual_value": "Contact in Future"}, {"id": "111111000000014732", "filtered": false, "display_value": "Contacted", "actual_value": "Contacted"} ] ``` ### Error Handling Refer to general API error handling for potential issues. ``` -------------------------------- ### Get All Inventory Templates Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Inventory_Templates Retrieves all available inventory templates. An empty Map can be passed as parameters. ```javascript var params = new Map(); var inventory_templates = ZDK.Apps.CRM.Inventory_Templates.getInventoryTemplates(params); ``` -------------------------------- ### Get All User Groups Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/User_Groups Retrieves all user groups. No parameters are required. ```javascript let params = new Map(); let user_groups = ZDK.Apps.CRM.User_Groups.getGroups(); ``` -------------------------------- ### initiate() Source: https://www.zohocrm.dev/explore/client-script/clientapi/BlueprintTransition Initiates a blueprint transition. ```APIDOC ## initiate () ### Description Initiate the transition. ### Method JavaScript ### Endpoint N/A ### Parameters None ### Request Example ```javascript var transObj = ZDK.Page.getBlueprintTransitions(); transObj[0].initiate(); ``` ### Response #### Success Response This method does not return a value upon successful initiation. ``` -------------------------------- ### Get All Feature Details Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Features Retrieves details for all available features. Requires an empty Map as a parameter. ```javascript var params = new Map(); var features = ZDK.Apps.CRM.Features.getFeatureDetails(params); ``` -------------------------------- ### Get Profiles using ZDK.Apps.CRM.Profiles.getProfiles Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Profiles Retrieves a list of profiles. Requires an empty Map for parameters and a header object. ```javascript var params = new Map(); var profiles = ZDK.Apps.CRM.Profiles.getProfiles(params, header); ``` -------------------------------- ### Get All Variables Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Variables Retrieves all variables. Pass an empty Map if no specific parameters are needed. ```javascript let params = new Map(); let variables = ZDK.Apps.CRM.Variables.getVariables(params); ``` -------------------------------- ### Get Related Records Count Example Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Get_Related_Records_Count Use this snippet to get the count of related records for a specified module and record. Ensure the ZDK object is available in your client script environment. ```javascript let get_related_records_count = new ZDK.Apps.CRM.Get_Related_Records_Count.Models.Get_Related_Records_Count(); get_related_records_count.related_list = { "api_name": "Notes" }; let record_id = "111111000000077056"; let module_api_name = "Leads"; var response = ZDK.Apps.CRM.Get_Related_Records_Count.getRelatedRecordsCount( [get_related_records_count], module_api_name, record_id); ``` -------------------------------- ### transitionTo Source: https://www.zohocrm.dev/explore/client-script/clientapi/Component Navigates to a specified screen using its API name. This method is applicable to wizard-type pages (Create/Edit Pages). ```APIDOC ## transitionTo ( api_name ) ### Description Makes the transition to the specified screen. ### Parameters #### Path Parameters - **api_name** (String) - Required - Api name of the screen ### Request Example ```javascript ZDK.Page.getComponent("record-create-wizard").transitionTo('Car_Loan'); ``` ### Supported Pages - wizard : Create / Edit Pages ``` -------------------------------- ### Create Record in Price Books Module Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/ModulesRecords Creates a record in the Price Books module, including pricing details. This example shows how to structure and associate complex related data like pricing tiers. ```javascript var book = new ZDK.Apps.CRM.Price_Books.Models.Price_Books(); book.Price_Book_Name = "test"; book.Pricing_Model = "Flat"; var pricing_detail = new ZDK.Apps.CRM.Price_Books.Models.Pricing_Details(); pricing_detail.from_range = 10; pricing_detail.to_range = 100; pricing_detail.discount = 5; var pricing_detail2 = new ZDK.Apps.CRM.Price_Books.Models.Pricing_Details(); pricing_detail2.from_range = 1000; pricing_detail2.to_range = 2000; pricing_detail2.discount = 10; var details = new Array(); details.push(pricing_detail); details.push(pricing_detail2); book.Pricing_Details = details; var response = ZDK.Apps.CRM.Price_Books.create(book); ``` -------------------------------- ### Retrieve Default Data Sharing Settings Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Data_Sharing Call this method to get the current default data sharing settings for the organization. No specific setup is required beyond importing the ZDK. ```javascript var data_sharing = ZDK.Apps.CRM.Data_Sharing.getDataSharing(); ``` -------------------------------- ### Get All Cadences - Client Script Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Cadences Use this client script to retrieve all available cadences. Ensure the ZDK object is available in your environment. ```javascript var apis = ZDK.Apps.CRM.Cadences.getCadences(); ``` -------------------------------- ### Get Users Source: https://www.zohocrm.dev/explore/client-script/zrc Make a GET request to retrieve a list of users in Zoho CRM. ```APIDOC ## GET /crm/v8/users ### Description Retrieves a list of users from Zoho CRM. ### Method GET ### Endpoint /crm/v8/users ### Request Example ```javascript const users = await zrc.get('/crm/v8/users'); ``` ### Response #### Success Response (200) - **status** (integer) - HTTP status code. - **data** (object) - Contains user information and pagination details. - **headers** (object) - Response headers. #### Response Example ```json { "status": 200, "data": { "users": [ { "id": "3891457000000556001", "full_name": "Catherin", "Modified_Time": "2025-04-24T18:10:09+05:30", "...": "..." } ], "info": { "per_page": 200, "count": 1, "...": "..." } }, "headers": { "cache-control": "no-store, no-cache, must-revalidate, private", "...": "..." } } ``` ``` -------------------------------- ### enable() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Button Enable the button. ```APIDOC ## enable ( ) ### Description Enable the button. ### Example ```javascript var save_btn = ZDK.Page.getButton('record_save'); save_btn.enable(); ``` ``` -------------------------------- ### Create Custom API Instance with zrc.createInstance Source: https://www.zohocrm.dev/explore/client-script/zrc/code_samples Use `zrc.createInstance` to create a client with a custom base URL. This is useful for simplifying repeated API calls to the same domain. ```javascript const api = zrc.createInstance({ baseUrl: "https://api.example.com" }); const users = await api.get("/users"); console.log(users.data); ``` -------------------------------- ### External API GET Request Source: https://www.zohocrm.dev/explore/client-script/zrc Make a GET request directly to an external REST API from the browser. ```APIDOC ## GET https://zylker.com/posts ### Description Fetches posts from an external API endpoint. ### Method GET ### Endpoint https://zylker.com/posts ### Request Example ```javascript const posts = await zrc.get('https://zylker.com/posts'); ``` ### Response #### Success Response (200) - **status** (integer) - HTTP status code. - **data** (array) - The response data from the API. - **headers** (object) - Response headers. #### Response Example ```json { "status": 200, "data": [ { "userId": 1, "id": 1 }, "..." ], "headers": { "cache-control": "max-age=43200", "content-type": "application/json; charset=utf-8", "...": "..." } } ``` ``` -------------------------------- ### Navigate to Record Create Page Source: https://www.zohocrm.dev/explore/client-script/clientapi/Client Navigate to the record creation page for a module, optionally specifying a layout ID. ```javascript ZDK.Client.navigateTo('record_create', { module: 'Leads', layout_id: "111111000000069302" }); ``` -------------------------------- ### Get Users Source: https://www.zohocrm.dev/explore/client-script/zrc/overview Make a GET request to retrieve user information from Zoho CRM API v8. ```APIDOC ## GET /crm/v8/users ### Description Retrieves a list of users from Zoho CRM. ### Method GET ### Endpoint /crm/v8/users ### Request Example ```javascript const users = await zrc.get('/crm/v8/users'); ``` ### Response #### Success Response (200) - **status** (integer) - The HTTP status code of the response. - **data** (object) - Contains user information and pagination details. - **users** (array) - An array of user objects. - **info** (object) - Pagination information. - **headers** (object) - The HTTP headers of the response. #### Response Example ```json { "status": 200, "data": { "users": [ { "id": "3891457000000556001", "full_name": "Catherin", "Modified_Time": "2025-04-24T18:10:09+05:30", "...": "..." } ], "info": { "per_page": 200, "count": 1, "...": "..." } }, "headers": { "cache-control": "no-store, no-cache, must-revalidate, private", "...": "..." } } ``` ``` -------------------------------- ### Get All Custom Views Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Custom_Views Fetches all custom views for a specified module. Requires the module name in the parameters. ```javascript var params = new Map(); params.set("module", "Leads"); var custom_views = ZDK.Apps.CRM.Custom_Views.getCustomViews(params); ``` -------------------------------- ### Get Specific Deal Details Source: https://www.zohocrm.dev/explore/client-script/zrc/overview Make a GET request to retrieve details of a specific record in the Deals module. ```APIDOC ## GET /crm/v8/Deals/{dealId} ### Description Retrieves the details of a specific deal record by its ID. ### Method GET ### Endpoint /crm/v8/Deals/{dealId} ### Parameters #### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to retrieve. ### Request Example ```javascript const deal = await zrc.get('/crm/v8/Deals/981234567810001', { params: { fields: 'Deal_Name,Stage,Amount' } }); ``` ### Response #### Success Response (200) - **status** (integer) - The HTTP status code of the response. - **data** (object) - Contains the deal data. - **data** (array) - An array containing the deal object. - **headers** (object) - The HTTP headers of the response. #### Response Example ```json { "status": 200, "data": { "data": [ { "id": "3891457000000567925", "Deal_Name": "Benton", "Stage": "Qualification", "Modified_Time": "2025-02-14T12:08:35+05:30", "...": "..." } ] }, "headers": { "cache-control": "no-store, no-cache, must-revalidate, private", "...": "..." } } ``` ``` -------------------------------- ### click() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Button Initiate the button click event. ```APIDOC ## click ( ) ### Description Initiate button click event. ### Example ```javascript var save_btn = ZDK.Page.getButton('record_save'); save_btn.click(); ``` ``` -------------------------------- ### ZDK.Client.showLoader Source: https://www.zohocrm.dev/explore/client-script/clientapi/Client Displays a loader with an optional message and configuration. The loader indicates that an operation is in progress. ```APIDOC ## ZDK.Client.showLoader ### Description Displays the loader with a message. The presence of an active loader restricts the availability of other pop-ups. ### Parameters #### Request Body - **config** (Object) - Optional - Configuration for the loader. - **type** (String) - Optional - Defaults to 'page'. Specifies the type of loader ('page'). - **template** (String) - Optional - Defaults to 'standard'. Specifies the template of the loader ('spinner', 'vertical-bar', 'standard'). 'spinner' and 'vertical-bar' can be used when invoking time-consuming APIs. - **message** (String) - Optional - Message to be displayed. Limit 240 characters. ### Request Example ```javascript ZDK.Client.showLoader({ type: 'page', template: 'vertical-bar', message: 'Loading ...' }); ``` ``` -------------------------------- ### Execute CRM Function with query params (GET) Source: https://www.zohocrm.dev/explore/client-script/zrc/code_samples Executes a custom CRM function using a GET request with query parameters. ```APIDOC ## Execute CRM Function with query params (GET) ### Description Executes a custom CRM function using a GET request with query parameters. Ensure 'oauth2' is enabled for the function in Zoho CRM. ### Method GET ### Endpoint /crm/v7/functions/{functionName}/actions/execute?auth_type=oauth ### Parameters #### Path Parameters - **functionName** (string) - Required - The API name of the function to execute. #### Query Parameters - **query** (string) - Optional - A query parameter to send to the function. ### Request Example ```javascript const function_response = zrc.get('/crm/v7/functions/my_function/actions/execute?auth_type=oauth', { params: { 'query': 'value1' } }); // query params can be received in Deluge function with 'crmAPIRequest.get('params')' // crmAPIRequest should be declared as Map type argument in the Deluge function. console.log(function_response.data.details.output); // Function output will be in details.output key ``` ### Response #### Success Response (200) - **details.output** (any) - The output returned by the executed CRM function. ``` -------------------------------- ### Get Specific Unsubscribe Link Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Unsubscribe_Links Retrieves a single unsubscribe link by its ID. Use this to get details of a specific unsubscribe link. ```javascript let id = "111111000000069031"; let unsubscribe_links = ZDK.Apps.CRM.Unsubscribe_Links.getUnsubscribeLink(id); ``` -------------------------------- ### Fetch Approval Process Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Settings Fetches all approval processes configured in the system. ```APIDOC ## Fetch Approval Process ### Description Fetches all approval processes configured in the system. ### Method `fetchApprovalProcess` ### Parameters None ### Response #### Success Response (200) - **array** - An array of approval process objects. ### Request Example ```javascript var approval_process = ZDK.Apps.CRM.Settings.fetchApprovalProcess(); ``` ``` -------------------------------- ### Initiate Blueprint Transition Source: https://www.zohocrm.dev/explore/client-script/clientapi/BlueprintTransition Executes a specific blueprint transition. This method triggers the workflow associated with the transition. ```javascript var transObj = ZDK.Page.getBlueprintTransitions(); transObj[0].initiate(); ``` -------------------------------- ### Get Single Subform Row Source: https://www.zohocrm.dev/explore/client-script/clientapi/Subform Retrieve a specific row from the subform by its index. The index is zero-based. This method returns a SubformRow object which can then be used to get values. ```javascript ZDK.Page.getSubform('CFSubform').getRow(index).getValues(); ``` -------------------------------- ### Send GET Request to Fetch Lead Details Source: https://www.zohocrm.dev/explore/client-script/zrc/zrc_methods Use zrc.get to send a GET request to a specific API endpoint. Query parameters can be passed in requestConfig.params and will be automatically encoded. ```javascript await zrc.get('/crm/v8/Leads/3705319000000662013') ``` -------------------------------- ### Create Record in Price Books Module Source: https://www.zohocrm.dev/explore/client-script/webapi_v2 Creates a record in the Price Books module, including pricing details and discount ranges. ```javascript var book = new ZDK.Apps.CRM.Price_Books.Models.Price_Books(); book.Price_Book_Name = "test"; book.Pricing_Model = ZDK.Apps.CRM.Price_Books.Models.Pricing_ModelPicklist.FLAT; var pricing_detail = new ZDK.Apps.CRM.Price_Books.Models.Pricing_Details(); pricing_detail.from_range = 10; pricing_detail.to_range = 100; pricing_detail.discount = 5; var pricing_detail2 = new ZDK.Apps.CRM.Price_Books.Models.Pricing_Details(); pricing_detail2.from_range = 1000; pricing_detail2.to_range = 2000; pricing_detail2.discount = 10; var details = new Array(); details.push(pricing_detail); details.push(pricing_detail2); book.Pricing_Details = details; var response = ZDK.Apps.CRM.Price_Books.create(book); ``` -------------------------------- ### Invoke GET Request with Parameters Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Connections Use this snippet to make a GET request to an external API. Pass an empty JSON object for headers if not required. Ensure the param_type is set to 1 for request parameters. ```javascript var parameters = {}; var headers = {}; parameters.ids = "347706269003,34770129002"; var response = ZDK.Apps.CRM.Connections.invoke("cscript", "https://www.zohoapis.com/crm/v2/Leads", "GET", 1, parameters, headers); ``` -------------------------------- ### Create Single Lead Record Source: https://www.zohocrm.dev/explore/client-script/webapi_v2 Creates a single Lead record. Demonstrates setting fields and using picklist values. ```javascript var lead = new ZDK.Apps.CRM.Leads.Models.Leads(); lead.Last_Name = "James"; lead.Lead_Status = ZDK.Apps.CRM.Leads.Models.Lead_StatusPicklist.CONTACTED; var response = ZDK.Apps.CRM.Leads.create(lead); ``` -------------------------------- ### getType() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Button Get the type of the button. ```APIDOC ## getType ( ) ### Description Get the type of the button. ### Returns - String: The type of the button (e.g., 'system' or 'custom'). ### Example ```javascript var buttonObj = ZDK.Page.getButtons(); buttonObj[0].getType(); ``` ### Output ``` system or custom ``` ``` -------------------------------- ### createInstance Source: https://www.zohocrm.dev/explore/client-script/zrc/zrc_methods Creates a reusable ZRC instance with default configurations, reducing repetition in multiple requests. Per-request overrides are allowed. ```APIDOC ## createInstance ### Description Creates a reusable ZRC instance with default configurations (like connection link name, base URL, headers, etc.), reducing repetition in multiple requests. Per-request overrides are allowed without affecting the base config. ### Method createInstance ### Parameters #### Request Body - **requestConfig** (object) - Base config for future API calls. The body is not accepted and will be ignored if provided. - **baseUrl** (string) - Optional - The base URL for the instance. - **connection** (string) - Optional - The name of the connection to use. - **headers** (object) - Optional - Default headers for the instance. ### Request Example (Connection-based) ```javascript const sheetZrc = zrc.createInstance({ baseUrl: 'https://sheets.googleapis.com/v4', connection: 'google_sheets' }); const sheet_info = await sheetZrc.get('/spreadsheets/98711121211100'); ``` ### Request Example (External API) ```javascript const myApi = zrc.createInstance({ baseUrl: 'https://api.myservice.com', headers: { Authorization: 'Bearer YOUR-TOKEN' } }); const allUserRes = await myApi.get('/users/'); ``` ``` -------------------------------- ### __create (params, header, extraData) Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Records Creates a new record with the provided parameters, headers, and extra data. ```APIDOC ## __create ( params , header , extraData ) ### Description Creates a new record. ### Method POST (Implicit) ### Parameters #### Path Parameters - **params** (Map) - Optional - API parameters - **header** (Map) - Optional - API headers - **extraData** (Map) - Optional - like trigger and apply_feature_execution data ### Request Example ```javascript var lead = new ZDK.Apps.CRM.Leads.Models.Leads(); lead.Last_Name = "James"; var params = new Map(); var header = new Map(); var extraData = new Map(); extraData.set("apply_feature_execution", [{ "name": "layout_rules" }]); extraData.set("skip_feature_execution", [{ "name": "cadences", "action": "insert" }]); extraData.set("trigger", ["approval", "workflow", "blueprint"]); var response = lead.__create(params, header, extraData); ``` ``` -------------------------------- ### getId() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Button Get the id of the button. ```APIDOC ## getId ( ) ### Description Get the id of the button. ### Returns - String: The unique identifier of the button. ### Example ```javascript var buttonObj = ZDK.Page.getButtons(); buttonObj[0].getId(); ``` ### Output ``` 1101122131 ``` ``` -------------------------------- ### Fetch Organization Details Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Org Use this snippet to retrieve the current organization's details. No specific setup is required beyond having access to the ZDK. ```javascript var org = ZDK.Apps.CRM.Org.fetch(); ``` -------------------------------- ### Execute CRM Function (GET) Source: https://www.zohocrm.dev/explore/client-script/zrc/code_samples Executes a custom CRM function using a GET request. Requires the function's API name and optional query parameters. Ensure 'oauth2' is enabled for the function in Zoho CRM. ```javascript const function_response = zrc.get('/crm/v7/functions/my_function/actions/execute?auth_type=oauth', { params: { 'query': 'value1' } }); // query params can be received in Deluge function with 'crmAPIRequest.get('params')' // crmAPIRequest should be declared as Map type argument in the Deluge function. console.log(function_response.data.details.output); // Function output will be in details.output key ``` -------------------------------- ### getApiName() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Button Get the API name of the button. ```APIDOC ## getApiName ( ) ### Description Get the API name of the button. ### Returns - String: The API name of the button. ### Example ```javascript var save_btn = ZDK.Page.getButton('record_save'); save_btn.getApiName(); ``` ### Output ``` record_save ``` ``` -------------------------------- ### Create Global Picklist Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Global_Picklists Creates a new global picklist with specified details. Requires an array of Global_Picklists objects. ```APIDOC ## POST Create Global Picklist ### Description Creates a new global picklist. Requires an array of Global_Picklists objects. ### Method POST ### Endpoint /crm/v8/settings/global_picklists ### Parameters #### Request Body - **Global_Picklists** (Array) - Required - An array of Global_Picklists objects to create. ``` -------------------------------- ### Create a Widget Flyout Source: https://www.zohocrm.dev/explore/client-script/clientapi/Client Creates a flyout container for widgets with customizable size, position, and animation. This example shows a basic flyout with a header and a specific animation type. ```javascript ZDK.Client.createFlyout('myFlyout', { header: 'Sample Flyout', animation_type: 4 }); ``` -------------------------------- ### getLabel() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Button Get the label (name) of the button. ```APIDOC ## getLabel ( ) ### Description Get the name of the button. ### Returns - String: The label of the button. ### Example ```javascript var buttonObj = ZDK.Page.getButtons(); buttonObj[0].getLabel(); ``` ### Output ``` Save ``` ``` -------------------------------- ### Update Currencies Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Org Updates existing currency configurations. This example first fetches a currency by ID and then updates its properties before sending the update request. ```javascript var currency = ZDK.Apps.CRM.Org.fetchCurrencyById("423383000005261048"); currency.prefix_symbol = true; currency.exchange_rate = "1.30000400"; var response = ZDK.Apps.CRM.Org.updateCurrencies( [currency]); ``` -------------------------------- ### Subform Event: beforeRowDelete(row_data, index) Source: https://www.zohocrm.dev/explore/client-script/event-dictionary/module_create_edit_wizard This event occurs after clicking the delete icon but before that subform row gets deleted. Add the "return false" statement at the end of the script, to prevent the row from getting deleted. ```APIDOC ## beforeRowDelete ( row_data , index ) ### Description This event occurs after clicking the delete icon but before that subform row gets deleted. Add the **"return false"** statement at the end of the script, to prevent the row from getting deleted. ### Method `beforeRowDelete` ### Parameters #### Path Parameters - **row_data** (object) - Required - Object details of the deleted row - **index** (number) - Required - Index of the deleted row ``` -------------------------------- ### Get Role Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Roles Retrieves a specific role by its ID. ```APIDOC ## Get Role ### Description Retrieves a specific role by its ID. ### Method GET (Implied by SDK usage) ### Endpoint `/roles/{role_id}` (Implied by SDK usage) ### Parameters #### Path Parameters - **role_id** (String) - Required - The ID of the role to retrieve. ### Response #### Success Response (200) - **role** (Roles) - The requested role object. ### Response Example ```json { "role": { "id": "111111000000116260", "name": "Product Manager", "description": "Schedule and manage resources" } } ``` ``` -------------------------------- ### Wizard Event: onLoad() Source: https://www.zohocrm.dev/explore/client-script/event-dictionary/module_create_edit_wizard This event occurs whenever the Client Script configured wizard is loaded. ```APIDOC ## onLoad ( ) ### Description This event occurs whenever the Client Script configured wizard is loaded. ### Method `onLoad` ### Parameters None ``` -------------------------------- ### ZDK HTTP POST Request Source: https://www.zohocrm.dev/explore/client-script/clientapi/HTTP Use this snippet to initiate a POST request. Specify the URL, content, and necessary headers like 'Content-Type'. ```javascript ZDK.HTTP.request({ url: 'https://zylker.com', method: 'POST', content: { name: 'Henry', }, headers: { 'Content-Type': 'application/json' } }); ``` -------------------------------- ### Get Roles Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Roles Retrieves a list of all available roles. ```APIDOC ## Get Roles ### Description Retrieves a list of all available roles. ### Method GET (Implied by SDK usage) ### Endpoint `/roles` (Implied by SDK usage) ### Parameters None ### Response #### Success Response (200) - **roles** (array) - An array of role objects. ### Response Example ```json { "roles": [ { "id": "111111000000000871", "name": "CEO", "description": "Chief Executive Officer" } ] } ``` ``` -------------------------------- ### getResponse() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Response Get the response object from an HTTP request. ```APIDOC ## getResponse ( ) ### Description Get the response object from an HTTP request. ### Method JavaScript (Client Script) ### Parameters None ### Response - **Object**: The response object. ### Request Example ```javascript var res = ZDK.HTTP.request({ 'url': 'https://zylker.com?q=dxt', 'method': 'GET' }); res.getResponse(); ``` ``` -------------------------------- ### Transition to Screen Source: https://www.zohocrm.dev/explore/client-script/clientapi/Component Navigate to a specified screen using its API name. This is primarily used for wizard-type pages. ```javascript ZDK.Page.getComponent("record-create-wizard").transitionTo('Car_Loan'); ``` -------------------------------- ### Get Unsubscribe Links Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Unsubscribe_Links Retrieves a list of all unsubscribe links. ```APIDOC ## getUnsubscribeLinks ( ) ### Description Retrieves a list of all unsubscribe links. ### Method ZDK.Apps.CRM.Unsubscribe_Links.getUnsubscribeLinks() ### Response #### Success Response (200) - **array** - An array of unsubscribe link objects. ``` -------------------------------- ### Call External API (Public) Source: https://www.zohocrm.dev/explore/client-script/zrc/code_samples Demonstrates how to call a public external API. ```APIDOC ## Call External API (Public) ### Description Demonstrates how to call a public external API. ### Method GET (or other applicable HTTP method) ### Endpoint [URL of the external API] ### Request Example ```javascript // Example using zrc.get for a public API // Replace with the actual URL and any necessary parameters const externalApiResponse = await zrc.get('https://api.example.com/data'); console.log(externalApiResponse.data); ``` ### Response #### Success Response (200) - **data** (any) - The response from the external API. ``` -------------------------------- ### Get Shift Hours Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Shift_Hours Retrieves a list of all shift hours. ```APIDOC ## getShiftHours ### Description Retrieves a list of all shift hours. ### Method ZDK.Apps.CRM.Shift_Hours.getShiftHours ### Parameters #### Header Parameters - **header** (Map) - Required - API headers ### Response #### Success Response - Returns an array of Shift_Hours objects. ``` -------------------------------- ### Fetch Layouts Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Settings Fetches all layouts for a specified module. Requires module name as a parameter. ```APIDOC ## Fetch Layouts ### Description Fetches all layouts for a specified module. Requires module name as a parameter. ### Method ZDK.Apps.CRM.Settings.fetchLayouts ### Parameters #### Path Parameters None #### Query Parameters - **params** (Map) - Required - API parameters. Must include `"module"` key. Example: `params.set("module", "Leads")` #### Request Body None ### Request Example ```javascript var params = new Map(); params.set("module", "Leads"); var layouts = ZDK.Apps.CRM.Settings.fetchLayouts(params); for (var i = 0; i < layouts.length; i++ ) { log(layouts[i]); } ``` ### Response #### Success Response (200) - **layouts** (array) - An array of layout objects. #### Response Example ```json [ { "id": "423383000000015966", "name": "Standard Layout" } ] ``` ``` -------------------------------- ### getStatusCode() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Response Get the status code from an HTTP request response. ```APIDOC ## getStatusCode ( ) ### Description Get the response's status code. ### Method JavaScript (Client Script) ### Parameters None ### Response - **Number**: The status code of the response. ### Request Example ```javascript var res = ZDK.HTTP.request({ 'url': 'https://zylker.com?q=dxt', 'method': 'GET' }); res.getStatusCode(); ``` ### Output Example ``` 201 ``` ``` -------------------------------- ### Update Fiscal Year Settings with ZDK Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Fiscal_Year Use this method to update the fiscal year settings. Ensure the Fiscal_Year model is correctly populated with desired values like start_month and display_based_on. ```javascript let fiscal_year = new ZDK.Apps.CRM.Fiscal_Year.Models.Fiscal_Year(); fiscal_year.start_month = "April"; fiscal_year.display_based_on = "end_month"; header.set("Content-Type", "application/json"); var response = ZDK.Apps.CRM.Fiscal_Year.updateFiscalYear(fiscal_year); ``` -------------------------------- ### getHeaders() Source: https://www.zohocrm.dev/explore/client-script/clientapi/Response Get the header object from an HTTP request response. ```APIDOC ## getHeaders ( ) ### Description Get the response's header object. ### Method JavaScript (Client Script) ### Parameters None ### Response - **Object**: The header object of the response. ### Request Example ```javascript var res = ZDK.HTTP.request({ 'url': 'https://zylker.com?q=dxt', 'method': 'GET' }); res.getHeaders(); ``` ``` -------------------------------- ### Get Data Backup Download URLs Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Backup Fetches the URLs for downloading data backup files. No parameters are required. ```javascript var urls = ZDK.Apps.CRM.Backup.getUrls(); ``` -------------------------------- ### Get Current User Source: https://www.zohocrm.dev/explore/client-script/zrc/code_samples Retrieves information about the currently logged-in user. ```APIDOC ## Get Current User ### Description Retrieves information about the currently logged-in user. ### Method GET ### Endpoint /crm/v8/users?type=CurrentUser ### Request Example ```javascript const currentUser = await zrc.get("/crm/v8/users?type=CurrentUser"); console.log(currentUser.data); ``` ### Response #### Success Response (200) - **data** (object) - Contains user information. ``` -------------------------------- ### Get Picklist Options Source: https://www.zohocrm.dev/explore/client-script/clientapi/Field Retrieve all available options for a picklist or multi-select picklist field. The output includes display and actual values for each option. ```javascript var field_obj = ZDK.Page.getField('Lead_Status'); field_obj.getPicklistOptions(); ``` -------------------------------- ### Get Variable By Id Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Variables Retrieves a specific variable by its unique ID. ```APIDOC ## ZDK.Apps.CRM.Variables.getVariableById ### Description Retrieves a specific variable by its unique ID. ### Method Signature `getVariableById(variable_id: String, params: Map): Variables` ### Parameters #### Path Parameters None #### Query Parameters - **variable_id** (String) - Required - The unique identifier of the variable. - **params** (Map) - Optional - API parameters for additional options. ### Request Example ```javascript let variable_id = "111113000000114321"; let variables = ZDK.Apps.CRM.Variables.getVariableById(variable_id); ``` ### Response #### Success Response - Returns a Variables object representing the requested variable. ``` -------------------------------- ### Fetch All Leads with Specific Fields (Promise Style) Source: https://www.zohocrm.dev/explore/client-script/zrc/code_samples Fetches all leads, selecting only the Last Name and First Name fields. Uses the Promise-based API. Handle potential errors with .catch(). ```javascript zrc.get('/crm/v8/Leads', { params: { fields: 'Last_Name,First_Name' } }).then(res => { console.log(res.data.data); }).catch (err => { console.error("Error fetching leads:", err); }); ``` -------------------------------- ### Get Variables Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Variables Retrieves a list of variables based on the provided parameters. ```APIDOC ## ZDK.Apps.CRM.Variables.getVariables ### Description Retrieves a list of variables. ### Method Signature `getVariables(params: Map): array` ### Parameters #### Path Parameters None #### Query Parameters - **params** (Map) - API parameters for filtering or pagination. ### Request Example ```javascript let params = new Map(); let variables = ZDK.Apps.CRM.Variables.getVariables(params); ``` ### Response #### Success Response - Returns an array of variable objects. ``` -------------------------------- ### Fetch Layouts for a Module Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Settings Retrieves all layouts for a given module. The module API name is required. ```javascript var params = new Map(); params.set("module", "Leads"); var layouts = ZDK.Apps.CRM.Settings.fetchLayouts(params); for (var i = 0; i < layouts.length; i++ ) { log(layouts[i]); } ``` -------------------------------- ### Get Territories of a User Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Users_Territories Retrieves all territories associated with a specific user. ```APIDOC ## getTerritoriesOfUser ### Description Retrieves all territories associated with a specific user. ### Method ZDK.Apps.CRM.Users_Territories.getTerritoriesOfUser ### Parameters #### Path Parameters - **user_id** (String) - Required - User Id - **params** (Map) - Optional - API parameters ### Request Example ```javascript let user_id = "111113000000057843"; let params = new Map(); let territories = ZDK.Apps.CRM.Users_Territories.getTerritoriesOfUser(user_id, params); ``` ### Response #### Success Response (200) - **array** - An array of territories. ``` -------------------------------- ### Get Scoring Rule Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Scoring_Rules Retrieves a specific scoring rule by its ID. ```APIDOC ## getScoringRule ( id , params ) ### Description Retrieves a specific scoring rule by its ID. ### Method ZDK.Apps.CRM.Scoring_Rules.getScoringRule ### Parameters #### Path Parameters None #### Query Parameters - **id** (String) - Required - The ID of the scoring rule to retrieve. - **params** (Map) - Optional - API parameters. Expected to contain 'module' (String). ### Request Example ```javascript let id = "111111000000116425"; let params = new Map(); params.set("module", "Leads"); let scoring_rules = ZDK.Apps.CRM.Scoring_Rules.getScoringRule(id, params); ``` ### Response #### Success Response (200) - **scoring_rules** (Scoring_Rules) - The requested scoring rule object. ``` -------------------------------- ### Get Associated Unsubscribe Links Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Unsubscribe_Links Retrieves associations for unsubscribe links. ```APIDOC ## getAssociatedUnsubscribeLinks ( ) ### Description Retrieves associations for unsubscribe links. ### Method ZDK.Apps.CRM.Unsubscribe_Links.getAssociatedUnsubscribeLinks() ### Response #### Success Response (200) - **Array** - An array containing unsubscribe link associations. ``` -------------------------------- ### Reusable ZRC Instance for Connection Requests Source: https://www.zohocrm.dev/explore/client-script/zrc/overview Create a reusable ZRC instance with baseUrl and connection configuration to simplify repeated requests to the same service. ```javascript const sheetZrc = zrc.createInstance({ baseUrl: 'https://sheets.googleapis.com/v4', connection: 'google_sheets' }); const sheet_info = await sheetZrc.get('/spreadsheets/98711121211100'); const sheet_value1 = await sheetZrc.get('/spreadsheets/98711121211102/values/A1'); const sheet_value2 = await sheetZrc.get('/spreadsheets/98711121211102/values/A2'); ``` -------------------------------- ### Create User Group Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/User_Groups Creates a new user group. Requires a User_Groups object with name, description, and sources. ```javascript let user_groups = new ZDK.Apps.CRM.User_Groups.Models.User_Groups(); user_groups.name = "test group"; user_groups.description = "my group"; user_groups.sources = [{ "source": { "name": "SDK", "id": "111111000000057843" }, "type": "users" }]var response = ZDK.Apps.CRM.User_Groups.createGroups( [user_groups]); ``` -------------------------------- ### Create a New Portal - JavaScript Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Portals Creates a new portal with the specified name. Ensure the portal name is unique. The response contains details of the created portal. ```javascript var portal = new ZDK.Apps.CRM.Portals.Models.Portals(); portal.name = "PortalsAPItest1001"; var response = ZDK.Apps.CRM.Portals.createPortal( [portal]); ``` -------------------------------- ### Get Feature Info Source: https://www.zohocrm.dev/explore/client-script/webapi Fetches feature information for specified records. ```APIDOC ## Get Feature Info ### Description Fetches feature information for specified records. ### Method ZDK.Apps.CRM.Leads.getFeatureInfo(ids, features) ### Parameters #### Path Parameters - **ids** (Array.) - Required - Record IDs (at max only 100 record IDs are allowed). - **features** (Array.) - Required - Features to retrieve information for (e.g., 'blocked_emails', 'consecutive_negative_emails'; at max only 5 features are allowed). ### Request Example ```javascript var response = ZDK.Apps.CRM.Leads.getFeatureInfo( ["111117000000,111117000001,111117000002"], ["blocked_emails,consecutive_negative_emails"]); for (var i = 0; i < response[0]._features_info.length; i++ ) { log(response[0]._features_info[i]); } ``` ``` -------------------------------- ### Get Variable by ID Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Variables Retrieves a specific variable using its unique ID. ```javascript let variable_id = "111113000000114321"; let variables = ZDK.Apps.CRM.Variables.getVariableById(variable_id); ``` -------------------------------- ### Get All Layouts for a Module Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Layouts Retrieves all layouts associated with a specific module. Requires a Map object with the module name. ```javascript var params = new Map(); params.set("module", "Leads"); var layouts = ZDK.Apps.CRM.Layouts.getLayouts(params); ``` -------------------------------- ### Create Custom Module Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Modules Creates a new custom module with specified labels, profiles, and display fields. The module object must be an array of Modules. ```javascript let module = new ZDK.Apps.CRM.Modules.Models.Modules(); module.plural_label = "Zylkers"; module.singular_label = "Zylker"; module.profiles = [{ "name": "Administrator", "id": "111111000000000495" }, { "name": "Standard", "id": "111111000000000497" }]; module.display_field = { "field_label": "Zylker", "data_type": "text" }; }; var response = ZDK.Apps.CRM.Modules.createCustomModules( [module]); ``` -------------------------------- ### Get Unsubscribe Link by ID Source: https://www.zohocrm.dev/explore/client-script/webapi_v8/Unsubscribe_Links Retrieves a specific unsubscribe link by its ID. ```APIDOC ## getUnsubscribeLink ( id ) ### Description Retrieves a specific unsubscribe link by its ID. ### Method ZDK.Apps.CRM.Unsubscribe_Links.getUnsubscribeLink(id) ### Parameters #### Path Parameters - **id** (String) - Required - The ID of the unsubscribe link to retrieve. ### Request Example ```javascript let id = "111111000000069031"; let unsubscribe_links = ZDK.Apps.CRM.Unsubscribe_Links.getUnsubscribeLink(id); ``` ### Response #### Success Response (200) - **Unsubscribe_Links** - The requested unsubscribe link object. ``` -------------------------------- ### ZDK.HTTP.request Source: https://www.zohocrm.dev/explore/client-script/clientapi/HTTP Initiates an AJAX request. Supports a maximum of 15 requests per page. ```APIDOC ## ZDK.HTTP.request ### Description Initiates an AJAX request to a specified URL with customizable method, content, headers, and parameters. ### Method Signature `request(request_object)` returns `{ Response }` ### Parameters #### request_object (object) An object containing the details for the HTTP request. - **request_object.url** (string) - Required - The URL to which the request is sent. - **request_object.method** (string) - Optional - The HTTP method to use. Defaults to 'GET'. Allowed values: 'POST', 'GET', 'PUT', 'DELETE', 'PATCH'. - **request_object.content** (string) - Optional - The request body. - **request_object.headers** (object) - Optional - Custom headers to include in the request. - **request_object.parameters** (object) - Optional - Query parameters to append to the URL. ### Request Example - GET ```javascript ZDK.HTTP.request({ url: 'https://zylker.com', method: 'GET', parameters: { query1: 'txt' } }); ``` ### Request Example - POST ```javascript ZDK.HTTP.request({ url: 'https://zylker.com', method: 'POST', content: { name: 'Henry' }, headers: { 'Content-Type': 'application/json' } }); ``` ```