For adding a record to the Accounts module, the <module_name> will be "Accounts". The <record_details> will be a map containing the field API names and their corresponding values. You'll need to use the API names of the fields, not necessarily the labels you see in the CRM interface[2].
Here is an example:```deluge
// Create a map to hold the account details
accountDetails = Map();
// Add field values using their API names
accountDetails.put("Account_Name", "New Example Account");
accountDetails.put("Phone", "[PHONE_NUMBER]");
accountDetails.put("Website", "www.example.com");
// Add other fields as needed, using their API names
// Create the record in the Accounts module
// The third and fourth parameters (options_map, connection) are optional
response = zoho.crm.createRecord("Accounts", accountDetails);
// Optional: Print the response to check if it was successful
info response;
code
**Explanation:**
1. **`accountDetails = Map();`**: This line creates an empty map variable called `accountDetails`. Maps are used to store key-value pairs, where the keys are the API names of the CRM fields and the values are the data you want to insert.
2. **`accountDetails.put("<field_api_name>", "<value>");`**: For each field you want to populate in the new account record, you use the `put()` method to add a key-value pair to the map.
* Replace `<field_api_name>` with the actual API name of the field in the Accounts module (e.g., "Account\_Name", "Phone", "Website"). You can find the API names in your Zoho CRM settings under Customization > Modules and Fields.
* Replace `<value>` with the data you want to insert into that field.
3. **`response = zoho.crm.createRecord("Accounts", accountDetails);`**: This is the core task to create the record.
* `"Accounts"`: Specifies the module where the record will be created.
* `accountDetails`: Provides the map containing the data for the new record.
4. **`info response;`**: This is an optional line that prints the response from the CRM API call. This response contains information about the created record, including its ID, which is useful for debugging.
**Important Considerations:**
* **API Names:** Ensure you use the correct API names for your fields. These might differ from the display labels[2].
* **Mandatory Fields:** You must include all mandatory fields for the Accounts module in your `accountDetails` map, otherwise, the record creation will fail[2].
* **Optional Parameters:** The `createRecord` task has optional parameters for `options_map` and `connection`[1].
* `options_map` can be used for things like triggering workflows or assignment rules[3][4].
* `connection` is typically used when interacting with a different Zoho CRM instance or through a custom connection.
* **Permissions:** The user or integration performing this Deluge script must have the necessary permissions to create records in the Accounts module[2].
This code provides a foundation for adding accounts. You can expand the `accountDetails` map to include data for any other fields in your Accounts module.